Skip to content

Commit

Permalink
fixed bug associate include option in associate.
Browse files Browse the repository at this point in the history
  • Loading branch information
authorNari committed Dec 9, 2008
1 parent 39de112 commit 93c0a49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions activerecord/lib/active_record/associations.rb
Expand Up @@ -1851,7 +1851,7 @@ def instantiate(rows)
def remove_duplicate_results!(base, records, associations)
case associations
when Symbol, String
reflection = base.reflections[associations]
reflection = base.reflections.with_indifferent_access[associations]
if reflection && [:has_many, :has_and_belongs_to_many].include?(reflection.macro)
records.each { |record| record.send(reflection.name).target.uniq! }
end
Expand All @@ -1861,7 +1861,7 @@ def remove_duplicate_results!(base, records, associations)
end
when Hash
associations.keys.each do |name|
reflection = base.reflections[name]
reflection = base.reflections.with_indifferent_access[name]
is_collection = [:has_many, :has_and_belongs_to_many].include?(reflection.macro)

parent_records = records.map do |record|
Expand Down

0 comments on commit 93c0a49

Please sign in to comment.