mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Deduplicate Active Record reflection names
This commit is contained in:
parent
a8328f61b6
commit
314d66b5a1
1 changed files with 2 additions and 2 deletions
|
@ -21,12 +21,12 @@ module ActiveRecord
|
|||
|
||||
def add_reflection(ar, name, reflection)
|
||||
ar.clear_reflections_cache
|
||||
name = name.to_s
|
||||
name = -name.to_s
|
||||
ar._reflections = ar._reflections.except(name).merge!(name => reflection)
|
||||
end
|
||||
|
||||
def add_aggregate_reflection(ar, name, reflection)
|
||||
ar.aggregate_reflections = ar.aggregate_reflections.merge(name.to_s => reflection)
|
||||
ar.aggregate_reflections = ar.aggregate_reflections.merge(-name.to_s => reflection)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in a new issue