Skip to content

Commit

Permalink
Fixed hmp for edgerails 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
snusnu committed Oct 17, 2008
1 parent d343f39 commit e11df9e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/has_many_polymorphs/reflection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ module ActiveRecord #:nodoc:
module Reflection #:nodoc:

module ClassMethods #:nodoc:

# Update the default reflection switch so that <tt>:has_many_polymorphs</tt> types get instantiated. It's not a composed method so we have to override the whole thing.

def create_reflection(macro, name, options, active_record)
case macro
when :has_many, :belongs_to, :has_one, :has_and_belongs_to_many
reflection = AssociationReflection.new(macro, name, options, active_record)
klass = options[:through] ? ThroughReflection : AssociationReflection
reflection = klass.new(macro, name, options, active_record)
when :composed_of
reflection = AggregateReflection.new(macro, name, options, active_record)
# added by has_many_polymorphs #
# added by has_many_polymorphs #
when :has_many_polymorphs
reflection = PolymorphicReflection.new(macro, name, options, active_record)
# end added #
end
write_inheritable_hash :reflections, name => reflection
reflection
Expand Down

1 comment on commit e11df9e

@bassnode
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for patching HMP. I was hopelessly sifting through ActiveRecord code before I found this!

Please sign in to comment.