Displaying flash messages in the layout can be a pain at times. In this episode you will learn an easy way to display any kind of flash message by looping through the hash.
<!-- layouts/application.rhtml -->
<% flash.each do |key, msg| %>
<%= content_tag :div, msg, :id => key %>
<% end %>
本篇教程介绍了一种简便的方法来展示各种Flash消息。通过遍历Hash实现消息的统一管理与展示,有效提升用户体验。

被折叠的 条评论
为什么被折叠?



