Swapnil Sawant Swapnil Sawant - 1 year ago 44
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 Source

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

And an example :

before_filter :authenticate


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