AASM installation (using AASM gem in your application)

October 09, 2008

AASM is a/the state machine plugin, which you can now use as a gem. To do this you need to do 2 things

  1. Install the GEM
  2. Tell your app about AASM


sudo gem sources -a http://gems.github.com
sudo gem install rubyist-aasm

note first line only required once per machine for any github gems

Configure Application

This is relatively new in rails. Idea is that you map a gem to a particular library in environment.rb. This is needed to deal with the fact that I might have several different aasm gems installed. Add following inside Rails::Initializer.run do |config| block

config.gem 'rubyist-aasm', :version => '~> 2.0.2', :lib => 'aasm', :source => "http://gems.github.com"

n.b. by configuring the application in this way we can use the rake tasks for gems (rake -T gems) i.e we should be able to install the gem using rake gems:install