Skip to content

Commit

Permalink
remove code duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeraj Singh committed May 22, 2013
1 parent b9bbc7f commit d226929
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions activerecord/lib/active_record/reflection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ def create_reflection(macro, name, scope, options, active_record)
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
Expand Down

0 comments on commit d226929

Please sign in to comment.