开发者

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

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


Lay some code out SWR, and this will also help! http://railscasts.com/episodes/196-nested-model-form-part-1

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜