Swapnil Sawant Swapnil Sawant - 4 months ago 9
Ruby Question

How to implement a login functionality without a database?

I want to create a login page for my project and validate a user without using any database.How can i do this? Is it possible with cache? Please guide me.

Answer

You could use HTTP Basic Authentication ? For reference, here is the railscast.

And an example :

before_filter :authenticate

protected

def authenticate
  authenticate_or_request_with_http_basic do |username, password|
    username == "foo" && password == "bar"
  end
end
Comments