I have two models, Article and Post that both inherit from a base model called ContentBase.
You can leave comments on both Articles and Posts, so I am using a Polymorphic Association between Comments and Article or Post.
However, since both Article and Post inherit from ContentBase, the commentable_type field ends up being "ContentBase" for both and screws everything up.
Is there a way to specify the commentable_type field in the has_many relationship in Article and Post?
Edit:
By "screws everything up" I mean if there is an Article with ID=1 and Post with ID=1 and I add a Comment with commentable_id=1, commentable_type=ContentBase, that comment will show up for both the Article and Post.
Here's the code:
class Article < BaseContent has_many :comments, :as => :commentable end
class Post < BaseContent has_many :comments, :as => :commentable end
and here's my Comment model:
class Comment < ActiveRecord::Base belongs_to :commentable, :polymorphic => true end