I would like to redirect the user in the authetication method if the request format is html or json, but always just show as the json format has been requested.
I've passed the (html and json) as parameters! Someone know if this is the right way to pass the parameters?
def authenticate_user!(html,json)
if request.format.html? && current_user.nil?
redirect_to login_url, notice: "Not authorized"
else
request.format.json? && current_user.nil?
redirect_to download_url, notice: "you need download the file first"
end
end
Aucun commentaire:
Enregistrer un commentaire