# 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 Subscribe by email
*
mkmurray 1 month ago
Awesome! No complaints here. The audio quality was sufficient, but if you have the means to improve it then go for it! =)
o Like
o Report
o Reply
o More ▼
Optional: Login
*
Eric Berry 1 month ago
mkmurray: Thanks for all your excellent comments. This one was done using iShowU HD. This is going to be the quality (video) for the remainder of the screencasts (I believe). The audio will be better once I can afford a good microphone, till then, it's a headset :(
o Like
o Report
o Reply
o More ▼
Optional: Login
discussion by DISQUS
Add New Comment
You are commenting as a Guest. You may log into:
Log into DISQUS
* Logged in as
* Logged in as Logout from DISQUS
description
Learn how to create a simple plugin using Ruby on Rails. This video will teach you how to turn a view helper into it's own plugin, and extend the ActionView::Base.