Commit 338b02c9b156c35e5d4554825f655ef148927c45
1 parent
0321d153
Exists in
master
and in
1 other branch
add error message to 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 | ... | ... |