Skip to content

Instantly share code, notes, and snippets.

@infernalmaster
Last active January 3, 2019 17:37
Show Gist options
  • Select an option

  • Save infernalmaster/730995e41e018964383d8b72c3ae1cbd to your computer and use it in GitHub Desktop.

Select an option

Save infernalmaster/730995e41e018964383d8b72c3ae1cbd to your computer and use it in GitHub Desktop.
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