diff options
Diffstat (limited to 'activerecord/lib/active_record/reflection.rb')
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 4bd6669f3c..de2204da29 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -21,14 +21,16 @@ module ActiveRecord end reflection = klass.new(macro, name, scope, options, ar) + add_reflection ar, name, reflection + reflection + end - if klass == AggregateReflection + def self.add_reflection(ar, name, reflection) + if reflection.class == AggregateReflection ar.aggregate_reflections = ar.aggregate_reflections.merge(name => reflection) else ar.reflections = ar.reflections.merge(name => reflection) end - - reflection end # \Reflection enables to interrogate Active Record classes and objects |