0
我在application_helper.rb
中使用这种方法来显示flash。但是,我需要它来显示闪光灯的内容和使闪光灯消失的链接,而我似乎无法做到这一点。它现在所做的只是显示一个“关闭”链接。在rails上嵌套content_tag的帮助3
def show_flash
[:notice, :error, :alert].collect do |key|
content_tag(:div, (flash[key] and content_tag(:a, "close", :class => "#{key}", :href => "#", :onclick => "$('messages').fade(); return false;")), :id => key, :class => "flash_#{key}") unless flash[key].blank?
end.join
end