1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

remove code duplication

This commit is contained in:
Neeraj Singh 2013-05-22 08:47:48 -04:00
parent b9bbc7f81a
commit d226929e5c

View file

@ -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