Problem with comment validation

I’m a new Rails programmer and I’ve been working on a simple blog
application to get started. But I have this problem with comment

I’m using REST throughout my entire app, and I have the comments
resource nested under the posts resource. I’m using a form on the show
action of my posts controller for submitting the comments. The form
goes to post_comments_path( and the comments will submit
properly, that part works. But if the model doesn’t validate, I can’t
get the browser to reload the show action and display what the user
originally typed in on the form, along with the errors.

My main question is, how do I display the errors if the form is under
a different controller (as well as “save” what the user types in)?

Here’s my form that displays on the show action:

<% form_for [:post, @comment], :url => post_comments_path( do
|f| %>

Add comment:

<%= error_messages_for :comment %>

<%= f.text_field :author %> Name

<%= f.text_field :email %> Email (will not be displayed)

<%= f.text_area :body, :rows => 10 %>

<%= submit_tag 'Add comment' %>

<% end %>

And here’s my create action in the comments controller:

def create
@comment =[:comment])
if @post.comments << @comment
redirect_to post_path(
# I don’t know what to put here

Any help would be much appreciated.

Never mind. I just found the answer. But actually, there’s another
problem now. Even though the record isn’t saved, the parts of the
comment that are completed show up on the comment section. Is there a
way to avoid this?