Commit 6eb59b4ea56ecddb5410f895a9a67463222f350b

Authored by Cyril Mougel
2 parents 0321d153 338b02c9
Exists in master and in 1 other branch production

Merge pull request #474 from chadcf/master

Add a helpful error message when non-admin users get a permission denied
Showing 1 changed file with 4 additions and 1 deletions   Show diff stats
app/controllers/application_controller.rb
... ... @@ -18,7 +18,10 @@ protected
18 18  
19 19  
20 20 def require_admin!
21   - redirect_to_root unless user_signed_in? && current_user.admin?
  21 + unless user_signed_in? && current_user.admin?
  22 + flash[:error] = "Sorry, you don't have permission to do that"
  23 + redirect_to_root
  24 + end
22 25 end
23 26  
24 27 def redirect_to_root
... ...