# Create the plugin
./script/generate plugin flash_helper
# init.rb
require File.dirname(__FILE__) + '/lib/flash_helper'
ActionView::Base.send(:include, FlashHelper)
# flash_helper.rb
module FlashHelper
def display_flash(flash)
ret = []
flash.each do |key, value|
ret << content_tag(:div, value, :id => "flash_#{key}")
end
return ret.join("\n")
end
end
# application.html.erb
<%= display_flash(flash) %>
2 Comments
Sort by Community Page...
View More