Solving Errors: uninitialized constant Authorization::AasmRoles::AASM
Posted by Vince Wadhwani on Sep 17, 2008
I'm updating my authentication methods for one of my sites and pulled a new version of the ubiquitous restful authentication plugin from Github. I decided to use the aasm gem instead of the acts as statemachine plugin but ran into a nasty looking error:
`load_missing_constant': uninitialized constant Authorization::AasmRoles::AASM
Yuck, I had the gem installed correctly and had generated my authentication using a pretty straight forward command right out of the ReadMe. So what gives?
Well, it turns out that the restful authentication plugin wasn't loading the aasm gem correctly. There are two easy ways to fix this.
1. In your application.rb you and simply add the line
require 'aasm'
OR
In your environment.rb, take advantage of the gem configuration capabilities of Rails by specifying the gem, lib, and source. It will then auto-load it for you.
config.gem 'rubyist-aasm', :lib => 'aasm', :source => 'http://gems.github.com'
That should be it. Once you fire up your rails app you should no longer get that nasty error.