我正在发送flash消息
redirect_to admin_root_path,:flash => { :success => "Password Changed successfully" }
但是当我尝试使用
检查其布局类型时<% flash.each do |type, msg| %>
<%= content_tag :div, type,class: "alert alert-danger" %>
<% end %>
当我将类型作为“成功”
传递时,它将其类型显示为“错误”这是怎么回事?
答案 0 :(得分:2)
试试这个.................
<% flash.each do |type, msg| %>
<%= content_tag :div, type,class: "alert alert-#{type}" %>
<% end %>
希望这对你有用。