D L wrote:
So you can see I have a form for block to handle the comments entry -
but if I have multiple blogs on a single page how can I specify that
this particular comment relates to blog X? If I only have one blog per
page I can get away with storing the blog id in the session, but this
seems a bit messy.
Hi D L,
(Welcome to Rails, by the way).
The key is to learn about how to specify the relationships between your
models. In your comment model, indicate that it's parent object is a
class Comment < ActiveRecord::Base
Now, anytime you have a Comment object, you can use comment.blog to
"get back" to the parent blog object.
Does this help? If I misunderstood the question somehow, let me know.