What you want to use here are polymorphic associations. They work mostly like what you have done, using two columns, one for the id, the other for the type. commentable_id commentable_type in your case.
Then you could define associations like has_many :comments, :as => :commentable, :dependent => :destroy and Rails would be able to handle al the sub tasks as it does with common associations. read the details here: http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html since it's a bit too complex to explain it here --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

