polymorphs 20

Release 20 of the has_many_polymorphs plugin is available.

new features

  • clear method on the polymorphic collection
  • push, <<, delete, and clear on all individual subcollections

An undocumented API was changed.

With double polymorphic relationships (say, eaters and foods) instead of using .corn_as_eater to access the Corn subcollection, you now need to use .food_corn. Referencing the join tables still uses as. This better parallels the general collection API.


Also, goodenough appeared on IRC and made a report:

class Hamster < ActiveRecord::Base
  has_many_polymorphs :toys,
    :from => [:wheels, :balls],
    :through => :hamsters

No join table! More to come.