我想在使用Rails的Ajax中显示Flash的错误消息,但它没有显示它,并且我尝试了几种方法来做到这一点,但我不能修正它。我怎样才能在rails中显示ajax的错误
这里是我的形式来显示我的错误:
#flash-error.flash-error{:style => "display: none"}
#flash-notice.flash-info{:style => "display: none"}
%h3 New Document
- form_for(:repo_document, :url => {:all_categories => @repo_categories, :action => "create", :format => "js", :query => params[:query]}, :html => { :id => "repo_document_form", :multipart => true, :target => 'upload_frame'}) do |form|
这里是控制器:
if !params[:stands]
respond_to do |format|
format.js do
responds_to_parent do
render :update do |page|
page.show "flash-error"
page.replace_html "flash-error","Please select stands you want to grant permission to view this stand."
end
end
end
return
end
end
我在做什么错?
在发布之前,你应该多做一些诊断 - 确保你点击了format.js块,并尝试在iframe中显示flash,以确保它不是一个responds_to_parent错误。 – klochner 2009-08-31 16:42:06