aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2013-05-22 08:47:48 -0400
committerNeeraj Singh <neerajdotname@gmail.com>2013-05-22 08:47:48 -0400
commitd226929e5cf16f9df38c9c95fb80d6bc33762884 (patch)
tree9a8bfa8094ecd7276fa701a899e4a18cd409d442 /activerecord
parentb9bbc7f81a12e166230dbec383bdaa895b332588 (diff)
downloadrails-d226929e5cf16f9df38c9c95fb80d6bc33762884.tar.gz
rails-d226929e5cf16f9df38c9c95fb80d6bc33762884.tar.bz2
rails-d226929e5cf16f9df38c9c95fb80d6bc33762884.zip
remove code duplication
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/reflection.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 1f76adb367..27aa20b6c0 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -21,11 +21,12 @@ module ActiveRecord
case macro
when :has_many, :belongs_to, :has_one, :has_and_belongs_to_many
klass = options[:through] ? ThroughReflection : AssociationReflection
- reflection = klass.new(macro, name, scope, options, active_record)
when :composed_of
- reflection = AggregateReflection.new(macro, name, scope, options, active_record)
+ klass = AggregateReflection
end
+ reflection = klass.new(macro, name, scope, options, active_record)
+
self.reflections = self.reflections.merge(name => reflection)
reflection
end