Created
October 1, 2012 10:49
-
-
Save vrinek/3810911 to your computer and use it in GitHub Desktop.
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
| if @user.try(:can_edit_post?) | |
| # do something | |
| 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
| def method_missing(method_name, *args, &block) | |
| if method_name =~ /^can_.+\?$/ | |
| action = method_name[/^can_(.+)\?$/, 1].to_sym | |
| @can_do.include?(action) | |
| else | |
| super | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment