当在 Recaptcha 中键入关键字没问题时,我总是会弹出这个空白的 flash 消息。为什么?我该如何解决这个问题?
路线
devise_for :users, :controllers => { :registrations => "registrations" }
注册控制器.rb
def create
if verify_recaptcha
super
flash.delete(:recaptcha_error)
else
build_resource
clean_up_passwords(resource)
flash.delete(:recaptcha_error)
flash[:alert] = "Typed keyword is not correct!"
render :template => '/registrations/new'
end
end
查看闪光灯
<% flash.each do |name, msg| %>
<div class="alert alert-<%= name == :notice ? "success" : "error" %>">
<a class="close" data-dismiss="alert">×</a>
<%= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String) %>
</div>
<% end %>