# Having a problem with acts\_as\_state\_machine

**URL:** <https://www.ruby-forum.com/t/having-a-problem-with-acts-as-state-machine/98207>\
**Category:** Rails\
**Created:** [July 13, 2006, 2:59am UTC](https://www.ruby-forum.com/t/having-a-problem-with-acts-as-state-machine/98207 "2006-07-13T02:59:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Forrest\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/ea5d25/32.png) [@Forrest\_C](https://www.ruby-forum.com/u/Forrest_C)\
**Post date:** [July 13, 2006, 2:59am UTC](https://www.ruby-forum.com/t/having-a-problem-with-acts-as-state-machine/98207/1 "2006-07-13T02:59:03Z")

</div>

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:in`method\_missing’  
> > from  
> > ./script/…/config/…/config/…/vendor/plugins/acts\_as\_state\_machine/lib/acts\_as\_state\_machine.rb:68:in  
> > `current\_state’  
> > from (irb):16

---

<div class="post-metadata">

**Author:** ![Forrest\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/ea5d25/32.png) [@Forrest\_C](https://www.ruby-forum.com/u/Forrest_C)\
**Post date:** [July 13, 2006, 4:40am UTC](https://www.ruby-forum.com/t/having-a-problem-with-acts-as-state-machine/98207/2 "2006-07-13T04:40:24Z")

</div>

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

THanks for listening…

Forrest

---

<div class="post-metadata">

**Author:** ![Forrest\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/ea5d25/32.png) [@Forrest\_C](https://www.ruby-forum.com/u/Forrest_C)\
**Post date:** [March 26, 2008, 10:05am UTC](https://www.ruby-forum.com/t/having-a-problem-with-acts-as-state-machine/98207/3 "2008-03-26T10:05:30Z")

</div>

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
