Skip to content

Commit

Permalink
Use map! instead of map for <association>_ids
Browse files Browse the repository at this point in the history
  • Loading branch information
lifo committed Jul 13, 2009
1 parent 373b053 commit 40b3875
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions activerecord/lib/active_record/associations.rb
Expand Up @@ -1276,9 +1276,9 @@ def collection_reader_method(reflection, association_proxy_class)
if reflection.through_reflection && reflection.source_reflection.belongs_to?
through = reflection.through_reflection
primary_key = reflection.source_reflection.primary_key_name
send(through.name).all(:select => "DISTINCT #{through.quoted_table_name}.#{primary_key}").map(&:"#{primary_key}")
send(through.name).all(:select => "DISTINCT #{through.quoted_table_name}.#{primary_key}").map!(&:"#{primary_key}")
else
send(reflection.name).all(:select => "#{reflection.quoted_table_name}.#{reflection.klass.primary_key}").map(&:id)
send(reflection.name).all(:select => "#{reflection.quoted_table_name}.#{reflection.klass.primary_key}").map!(&:id)
end
end
end
Expand Down

0 comments on commit 40b3875

Please sign in to comment.