Could you recommend me a more complete book that I can read so I understand the basics? I really feel like I don't right now.
Thank you. On Fri, Jan 27, 2012 at 7:12 PM, Mohamad El-Husseini <[email protected] > wrote: > Well, frankly, if I were you, I would read the documentation again. It > doesn't seem like you know what a polymorphic association is. You described > a standard has_many relationship. > > Polymorphic association is when one model belongs to several different > models. For example, to use the Rails casts episode, a comment can belong > to a Photo, a Post, or a Product. > > From what you have written so far, it seems like you want a standard > has_many and belongs_to association. > > User has_many :posts will let you do @user.posts, and a Post belongs_to > :user will let you do post.user. If you want customize the name of the > association, as in post.author, then I think you need to use the :class_name > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/hwFc1eURfFwJ. > > 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. > -- 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.

