Skip to content

Instantly share code, notes, and snippets.

@zachlatta
Created December 31, 2013 09:25
Show Gist options
  • Save zachlatta/8194446 to your computer and use it in GitHub Desktop.
Save zachlatta/8194446 to your computer and use it in GitHub Desktop.
The magic of metaprogramming.
class PagesPolicy < ApplicationPolicy
%w(home about contact acknowledgements sign_up_selection).each do |a|
define_method "#{a}?" do
true
end
end
end
class PagesPolicy < ApplicationPolicy
def home?
true
end
def about?
true
end
def contact?
true
end
def acknowledgements?
true
end
def sign_up_selection?
true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment