What is the best way to password protect a view? I already generate a password, but I do not want the username and password to be logged in, just the password. I have a password that is currently stored as an attribute in the File class, and used this:
before_filter :restrict, :only => :show
authenticate_or_request_with_http_basic do |password|
password == @file.password
end
However, it still asks for the username from the user and is not logging in correctly because the username is missing. Is there a way to use this method, and only the request will tell only the password? If not the best way to do this?
source
share