what's happened to acts_as_state_machine

20 views
Skip to first unread message

John Small

unread,
Feb 25, 2009, 10:12:08 AM2/25/09
to rubyonra...@googlegroups.com
I went to get the latest acts_as_state_machine from
http://github.com/rubyist/aasm/tree/master and to my untrained eye it
appears not to work anymore. At least it doesn't work the same way that
the old acts_as_state_machine worked and there's no explanation for
getting the new stuff running in an AR.

Does anyone know what's going on here? Should I just copy an old version
and use that while they sort out the new version?

Ta

John Small
--
Posted via http://www.ruby-forum.com/.

Robert Walker

unread,
Feb 25, 2009, 12:30:15 PM2/25/09
to rubyonra...@googlegroups.com

John Small

unread,
Feb 25, 2009, 1:35:54 PM2/25/09
to rubyonra...@googlegroups.com
Yes I know that, because that's where I got the gem from.

What I need to know is how to get the thing working with AR because the
extremely slim example given in the readme just plain does not work.

Does anyone know the ins and outs of getting the new aasm working with
AR?

Ta

John Small

Rick

unread,
Feb 25, 2009, 1:50:05 PM2/25/09
to Ruby on Rails: Talk
I use aasm with restful-authentication which gem has some info on
getting aasm to work. I'm not sure if rest-auth's info is redundant
with other gems but it works for me.

I've used it with Ruby 1.8.[67] and 1.9.1 and Rails 2.[12].2 and
2.3.0.

Check out the README.textile.

On Feb 25, 8:35 am, John Small <rails-mailing-l...@andreas-s.net>
wrote:

John Small

unread,
Feb 25, 2009, 2:11:22 PM2/25/09
to rubyonra...@googlegroups.com
Rick wrote:

> Check out the README.textile.
>
> On Feb 25, 8:35�am, John Small <rails-mailing-l...@andreas-s.net>

I checked out the README.textile for restful_authentication, which
doesn't really say anything about aasm. The generator just generates
code for the old aasm, which doesn't work with the new one.

To save time I've just gone back to the old aasm plugin and it's now
running OK.

If anyone does have a clear set of instructions on how to set up the new
aasm to work with AR I'd love to hear about it.

A clear set of instructions means "instead of writing
acts_as_state_machine you should write ..." and "instead of event use
..." it doesn't mean, "I heard of someone who might have written a blog
article where he mentioned it in passing"

szimek

unread,
Feb 25, 2009, 2:56:10 PM2/25/09
to Ruby on Rails: Talk
The way it is now written there shouldn't be any difference between
using aasm with AR and any other Ruby class.

Here's very basic example from our User model:

class User < ActiveRecord::Base
include AASM
aasm_column :state # I guess it's the only AR specific method here
aasm_initial_state :created
aasm_state :created
aasm_state :pending, :enter => :send_activation_emai
...
aasm_event :register do
transitions :to => :registered, :from => :activated
end
...
end

John Small

unread,
Feb 26, 2009, 2:20:13 AM2/26/09
to rubyonra...@googlegroups.com

> aasm_column :state # I guess it's the only AR specific method here

Ah! The vital bit of information which is always left out of the
instructions. It works now that I've put that line in. Thanks.

It seems to be part of the culture to always leave out a key bit of
information required to get things to work so that people who haven't
written the code have to scrabble around in news groups and blogs to
find the secret.

Thanks

Robert Walker

unread,
Feb 26, 2009, 11:05:27 PM2/26/09
to rubyonra...@googlegroups.com
John Small wrote:
>
>> It morphed into aasm:
>> http://github.com/rubyist/aasm/tree/master
> Yes I know that, because that's where I got the gem from.

Oops! Sorry John I didn't look closely enough at your post. I thought
you were trying to use the old acts_as_state_machine plugin.

I'm glad to see you got it going though.

Reply all
Reply to author
Forward
0 new messages