Having a problem with acts_as_state_machine

Hi all:

Below is s a dump from script/console in development env.

Am I not supposed to be able to find the record later and use the
state machine functionality, or have I missed something? Thanks

Forrest


ts2 = TalkSession.create( :person_id => 2, :pattern_id => 2)
=> #<TalkSession:0x35811f0 @attributes={“pattern_id”=>2, “id”=>11,
“person_id”=>
2, “state”=>“looking_for_experts”}, @new_record=false,
@errors=#<ActiveRecord::Errors:0x34627b0 @base=#<TalkSession:0x35811f0
…>, @errors={}>>

ts3 = TalkSession.find_by_person_id 2
=> #<TalkSession:0x32f5f08 @attributes={“pattern_id”=>“2”, “id”=>“11”,
“person_id”=>“2”}>

ts2.current_state
=> :looking_for_experts

ts3.current_state
NoMethodError: undefined method state' for #<TalkSession:0x32f5f08> from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1792:inmethod_missing’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_state_machine/lib/acts_as_state_machine.rb:68:in
`current_state’
from (irb):16

Nevermind, figured it out, I didn’t put a column for state in the DB.

THanks for listening…

Forrest

Hi Forrest C.,

Can u please tell me how can I use the acts_as_state_machine with
example.

I want to use the plug in for work flow of my application.
I am waiting to your reply.

Thanks

srinivasrao.pala