Problem with error_messages

Hi all,

I have a problem with error_messages displaying correctly. I have a page
to show an item. That page has a comment form (which calls to the
controller ‘comment’ with action ‘create’) and below a list of comments
for that item.

The problem is, when I submit a comment that doesn’t pass validation,
error messages are not displayed. I think it’s because I have the
comments form ‘embedded’ on the ‘show’ page. Here is my code, I tried to
trim as much stuff as possible:

Item view: show.rhtml:


<%= render(:partial => ‘item’, :locals => { :item => @item }) -%>

<%= start_form_tag :controller => ‘comments’, :action => ‘create’,
:item_id => @item.id %>
<%= render :partial => ‘new_comment_form’ %>

_new_comment_form.rhtml:


<%= error_messages_for ‘comment’ %>

<%= end_form_tag %>

comments_controller.rb:

def create
@comment = Comment.new(params[:comment])

...


if @comment.save
  flash[:notice] = 'Thank you! Comment added successfully.'
  redirect_to :controller => 'items', :action => 'show', :id =>

@comment.item_id
else
render :controller => ‘items’, :action => ‘show’
end
end