Created
January 12, 2010 21:52
-
-
Save coderberry/275662 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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) %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment