Last active
January 3, 2019 17:37
-
-
Save infernalmaster/730995e41e018964383d8b72c3ae1cbd 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 user_not_authorized | |
| flash[:alert] = 'You are not authorized to perform this action.' | |
| can_be_infinite_redirect = request.url == request.referer | |
| if can_be_infinite_redirect | |
| redirect_to root_path | |
| else | |
| redirect_back(fallback_location: root_path) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment