Created
September 15, 2010 00:37
-
-
Save cmelbye/580039 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
def restrict_to_owner(application, error = false, &block) | |
return unless logged_in? | |
if application.is_owner? current_user | |
p block | |
p block.call | |
block.call | |
elsif error | |
flash[:error] = 'You must be an owner of this application to do that.' | |
redirect_to(application) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment