Andrew McDonough

Please note: This page is imported from my wiki, which hasn't been updated in over 10 years. Some of the formatting was lost during the import. I'll try to get around to fixing it someday.

Restful Authentication|Rick Olsen’s restful authentication is my current preferred method for authenticating users.


Add Rick Olsen’s repository ruby script/plugin source

Install the resfulauthentication plugin ruby script/plugin install restfulauthentication

Generate the ruby script/generate authenticated user sessions —include-activation

Create the tables in the database rake db:migrate

Add the following routes to config/routes.rb map.activate ‘/activate/:activationcode’, :controller => ‘users’, :action => ‘activate’, :activationcode => nil map.signup ‘/signup’, :controller => ‘users’, :action => ‘new’ map.login ‘/login’, :controller => ‘sessions’, :action => ‘new’ map.logout ‘/logout’, :controller => ‘sessions’, :action => ‘destroy’

Now for any controllers to which you want to restrict access, add the following line: beforefilter :loginrequired

Andrew McDonough

Andrew McDonough is a consultant CTO and software developer, currently based between Berlin and London.

Follow Andrew on Twitter or Connect on LinkedIn