"Create" form in another Controller's "show" view

This seems like a really obvious question, but I’m blanking on the
solution. I have a simple post/comments relationship that fits the
basic blog model. That means that the form to create a new comment is
in the show action in the Posts controller, but the form links to the
create action in the Comments controller. My question is basically: is
this the best way to model that relationship? The problem I’m running
into is that when posting a comment fails due to missing fields, you
can’t easily “render :action => ‘new’” to retain the values while
displaying an error message.

What am I missing?

The problem is that you cant render another controllers action the
traditional way. In the comments controller you have to render :template
=> ‘posts/show’ when a comment fails validation.

Thank you. :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs