DRY up empty controller actions
Ever create Rails views that don't user the controller at all just to take advantage of an application layout?
If you have, you may have a lot of code that looks like this:
Well, there's a simple way to make this a lot cleaner...
Now your controller can look like this instead...
If you have, you may have a lot of code that looks like this:
class HelpController < ApplicationController def index end def tutorial end def faq end end
Well, there's a simple way to make this a lot cleaner...
class ApplicationController < ActionController::Base def self.simple_action(*actions) actions.each {|action| class_eval("def #{action}; end")} end end
Now your controller can look like this instead...
class HelpController < ApplicationController simple_action :index, :tutorial, :faq end