Skip to content
Browse files

Move lambda to outside the loop.

  • Loading branch information...
1 parent 3e26d50 commit 1c51538efe8e186e4f82a7339f11816cfb9daaff @mpereira mpereira committed Sep 23, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/tasks/answers_into_search_results.rake
View
8 lib/tasks/answers_into_search_results.rake
@@ -19,6 +19,10 @@ namespace :data do
"/answers/#{params[:answer_id]}")
end
+ optional = lambda do |object, message|
+ object.respond_to?(message) ? object.send(message) : nil
+ end
+
Answer.find_each(:batch_size => 100, :fields => [:id,
:title,
:body,
@@ -59,10 +63,6 @@ namespace :data do
:voteable_type => search_result.class.to_s)
end
- optional = lambda do |object, message|
- object.respond_to?(message) ? object.send(message) : nil
- end
-
Comment.
where(:commentable_id => answer.id, :commentable_type => 'Answer').
fields([:banned,

0 comments on commit 1c51538

Please sign in to comment.
Something went wrong with that request. Please try again.