Created
June 12, 2019 13:44
-
-
Save spencerldixon/8c5473d8e57bc6cda5826015dcebcaa9 to your computer and use it in GitHub Desktop.
Only admins can access this
This file contains 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 require_admin | |
return if current_user.admin? | |
redirect_to root_path, notice: "Only admins can access this area" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place this as a
protected
helper in yourapplication_controller.rb
file