I'm just doing: comment = Comment.New() # set comment properties here comment.save Post.comments << comment
On Oct 29, 1:35 pm, reHa <[EMAIL PROTECTED]> wrote: > On Oct 29, 3:31 pm, et <[EMAIL PROTECTED]> wrote: > > > > > I have two models, Article and Post, that has many Comments. However, > > both Article and Post are inherited from a BaseContent class like so: > > > 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 > > > Now when I try to associate a comment with an Article or Post, the > > commentable_type field gets set as "BaseContent" instead of "Article" > > or "Post." Is there a way to specify what the commentable_type field > > is? > > Hi, > > can you show how are you creating Post and Comment and "joining" them? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

