【发布时间】:2012-12-18 00:40:57
【问题描述】:
我将表单更改为远程,虽然表单现在可以工作,但如果出现错误,则不再显示错误消息。
<%= render 'shared/error_messages' %>
有什么好衣服可以让消息再次显示吗?
下面是我的控制器...
谢谢。
respond_to do |format|
if @post.save
format.js { render :js => "window.location = '#{edit_post_path @post}'" }
format.html { redirect_to [:edit, @post] }
else
format.js { render :js => @post.errors }
format.html { redirect_to '/', :error => "Could not save comment" }
end
end
【问题讨论】:
标签: ruby-on-rails ajax ruby-on-rails-3 forms error-handling