Rails show view of one model with form for adding one child - nested attributes vs seperate controll

Posted by SWR on Stack Overflow See other posts from Stack Overflow or by SWR
Published on 2010-01-19T00:26:48Z Indexed on 2010/03/14 14:25 UTC
Read the original article Hit count: 160

I have a basic two tiered model structure: Articles -> Comments with one Article having many comments.

What is the best way to add a "Add a comment" form to the bottom of the Articles show page?

nested_attributes is overkill as I don't want to be able to edit all of the comments on the page, just to add one more.

Is the best way even with Rails 2.3 still to make a separate controller and embed a form_for pointing to the other controller into the Articles show view? If so, how do I get validation errors to return to the article display page?

I don't want to make a separate comment page/view...

thanks

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about nested-attributes