Here are the steps I took to install restful_authentication with acts_as_state_machine (using the new aasm gem) as plugins.
Started in the rails home directory of the app.
Installed aasm gem as a plugin:
script/plugin install git://github.com/rubyist/aasm.git
(thanks to Erik on Rails for the above)
Installed restful authentication:
git submodule add \git://github.com/technoweenie/restful-authentication.git \vendor/plugins/restful_authentication
I use capistrano so I also added the following to my config/deploy.rb file
set :git_enable_submodules, 1
Created a lib directory in the app home directory:
mkdir lib
Called the restful authentication generator. Fyi, instead of user, I use person as the name of my model for people:
./script/generate authenticated person sessions --include-activation --aasm
Then I did the post-generate steps, following some of the instructions at github. Some of the steps enumerated in the docs seem to be taken care of as part of the generate call now.
In config/routes.rb, I did a find/replace on peoples (incorrect plural) replacing all with people (correct plural) and added the activate route. In the end my routes.rb looked like this:
map.logout '/logout', :controller => 'sessions', :action => 'destroy'map.login '/login', :controller => 'sessions', :action => 'new'map.register '/register', :controller => 'people', :action => 'create'map.signup '/signup', :controller => 'people', :action => 'new'map.activate '/activate/:activation_code', :controller => 'people',:action => 'activate', :activation_code => nilmap.resources :people, :member => { :suspend => :put,:unsuspend => :put,:purge => :delete }
In config/environment.rb, I added:
config.active_record.observers = :person_observer
So I can use before filters in my controllers, I modified app/controllers/application.rb to include AuthenticatedSystem:
class ApplicationController < ActionController::Basehelper :allinclude AuthenticatedSystemend
I adjusted the language in app/models/person_mailer.rb, especially replacing the YOURSITE references to be the URL of my site:
@body[:url] ="http://www.landlessness.net/activate/#{person.activation_code}"