I’m trying to learn about using remote forms and using the example of an app where the Post model has_many Comments.
Assuming i have used the generic rails scaffolding to create/setup the post/comment model, controllers, default views, routes, etc, — what should my app/views/posts/show.html look like?
Specific i am confused about:
- Where should the comment form post to?
- What parameters should be included?
- Do i NEED to use a hidden attribute such as
f.hidden_field :post_id, :value => @post.id
Thank you!
Assuming that your post has_many comments…
routes.rb (Nested Resources)
In your comments_controller
In the form: