Rails RESTful Authentication Example Application

FOR RAILS 3.0: A newer and more current Rails authentication example app shows how to set up Rails with the Devise authentication gem. It’s got a detailed Rails authentication tutorial plus an application template that can be used to generate a starter app. It shows how to use RSpec and Cucumber for testing with Devise as well. There’s a similar example app that shows how to set up Devise for authentication with the Mongoid gem and MongoDB database for quick development without schemas or migrations.

UPDATE: Rails has advanced since this application was released in mid-2008. As of February 2010, Rails is currently at version 2.3.5 (and Rails 3 is in beta). Several Rails gems are now available that provide a turnkey authentication solution, including Authlogic, Devise, and Clearance. You can also look at Technoweenie’s restful-authentication generator. The Ruby Toolbox page for Rails Authentication shows which are most popular. I personally recommend Devise.

I’ve released an open source Rails application that provides an example of RESTful Authentication.

It provides a complete system for managing users, including sign up and verification of a new user’s email address, login with role-based access control, and a system of resetting forgotten passwords, all using a RESTful architecture.

You can easily customize the application for your own needs.

You can obtain the source code here:

It is based on recommendations from the forum discussion Restful Authentication With All the Bells and Whistles.


8 Responses to Rails RESTful Authentication Example Application

  1. […] I’ve released my own Rails RESTful Authentication Example Application. Possibly related posts: (automatically generated)looking for a barebone social network framework in […]

  2. Rodrigo says:

    Nice example app, but the rpsec tests finds loots of errors 😦

  3. kehoe says:

    @Rodrigo: If you’re finding rspec test failures, make sure you’ve set up the app to send email. The rspec tests send real email and if the app isn’t set to send email, you’ll get 26 errors. Grab the latest version if you’re still getting any errors (fixed two routing errors today). Hope that helps! let me know if it doesn’t. Thanks for the comment.

  4. […] Rails RESTful Authentication Example Application now has a Get Satisfaction support […]

  5. Danny says:

    I have an app that divides up content by subdomains. subdomain1.myapp.com and subdomain2.myapp.com show different content. I want to be able to assign individual users roles on different sites.

    For instance, user1 might be an administrator on subdomain1, but have no rights on subdomain2. User2 might have administrator rights on both, while user3 has administrator rights on one and another role on the other.

    Do you have any suggestions as to how to go about this?

  6. Greg says:


    I’d be really appreciative of old-fashioned integration tests.


  7. thomasalbert says:

    Hi, I’m using a fresh download of the origen restful authentication and when I sign up as a new user the activation code sent in the email is different to the activation code saved in the database. Any idea what is going wrong?

  8. Greg says:

    Thomas,The docs that come with the plugin mention your problem and how to fix it.

%d bloggers like this: