Wednesday, March 12, 2008

acts_as_state_machine: make initial state exists!

Ugh.. I tried out acts_as_state_machine and I kept getting this nil error and I had no idea why. I mean, I followed the code in agilewebdevelopment.com properly. Here's the code in that website:


acts_as_state_machine :initial => :created, :column => 'status'

# These are all of the states for the existing system.
state :submitted
state :processing
state :nonprofit_reviewing
state :accepted


Oh... apparently, you need to add


state :created


to it as well :)

No comments: