Showing 2 videos tagged with generator

Creating a Simple Plugin

# 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

Railscast - Episode 58: How to Make a Generator

00:11:11 railscasts.com
Rails comes with many built-in generators, but what if you want to customize them or make your own? Rails gives you a great way to do this which you will learn in this episode.