Skip to content

Instantly share code, notes, and snippets.

@igor-alexandrov
Created August 6, 2010 12:50
Show Gist options
  • Save igor-alexandrov/511269 to your computer and use it in GitHub Desktop.
Save igor-alexandrov/511269 to your computer and use it in GitHub Desktop.
DRY up empty controller actions
class Admin::AdminController < ActionController::Base
def self.simple_action(*actions)
actions.each {|action| class_eval("def #{action}; end")}
end
end
class Admin::ArticlesController < Admin::AdminController
simple_action :show, :edit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment