I forgot about the problems with STI
you would have to define commentable_type method in BaseContent as
said in the: activerecord/lib/active_record/associations.rb

    # Using polymorphic associations in combination with single table
inheritance (STI) is a little tricky. In order
    # for the associations to work as expected, ensure that you store
the base model for the STI models in the
    # type column of the polymorphic association. To continue with the
asset example above, suppose there are guest posts
    # and member posts that use the posts table for STI. In this case,
there must be a +type+ column in the posts table.
    #
    #   class Asset < ActiveRecord::Base
    #     belongs_to :attachable, :polymorphic => true
    #
    #     def attachable_type=(sType)
    #        super(sType.to_s.classify.constantize.base_class.to_s)
    #     end
    #   end
    #
    #   class Post < ActiveRecord::Base
    #     # because we store "Post" in attachable_type now :dependent
=> :destroy will work
    #     has_many :assets, :as => :attachable, :dependent => :destroy
    #   end
    #
    #   class GuestPost < Post
    #   end
    #
    #   class MemberPost < Post
    #   end
    #
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to