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:
parent
b9bbc7f81a
commit
d226929e5c
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue