Skip to content

Instantly share code, notes, and snippets.

@zzak
Forked from cmelbye/gist:580039
Created September 15, 2010 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zzak/580042 to your computer and use it in GitHub Desktop.
Save zzak/580042 to your computer and use it in GitHub Desktop.
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