Refactor select().map() to use pluck.

Remove a method already provided by ActiveRecord.
This commit is contained in:
Josh Susser and Avdi Grimm
2013-05-17 15:11:37 -04:00
committed by Avdi Grimm
parent d30330441a
commit 5659b66729
4 changed files with 4 additions and 8 deletions

View File

@@ -43,7 +43,7 @@ class PostDestroyer
@post.update_flagged_posts_count
# Remove any reply records that point to deleted posts
post_ids = PostReply.select(:post_id).where(reply_id: @post.id).map(&:post_id)
post_ids = PostReply.where(reply_id: @post.id).pluck(:post_id)
PostReply.delete_all reply_id: @post.id
if post_ids.present?