Created
December 31, 2013 09:25
-
-
Save zachlatta/8194446 to your computer and use it in GitHub Desktop.
The magic of metaprogramming.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PagesPolicy < ApplicationPolicy | |
%w(home about contact acknowledgements sign_up_selection).each do |a| | |
define_method "#{a}?" do | |
true | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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