From eb8d48eb3ea27b7a7470eb9668748abd4914386b Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 23 Jul 2013 13:12:25 -0700 Subject: factory methods should not have side effects. Move model mutation to the methods that are called on the model. --- activerecord/lib/active_record/reflection.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'activerecord/lib/active_record/reflection.rb') diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index de2204da29..55c58319b2 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -20,9 +20,7 @@ module ActiveRecord klass = AggregateReflection end - reflection = klass.new(macro, name, scope, options, ar) - add_reflection ar, name, reflection - reflection + klass.new(macro, name, scope, options, ar) end def self.add_reflection(ar, name, reflection) -- cgit v1.2.3