Forum: Ruby on Rails what's happened to acts_as_state_machine

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John S. (Guest)
on 2009-02-25 17:12
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 S.
Robert W. (Guest)
on 2009-02-25 19:30
John S. wrote:
> 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 S.

It morphed into aasm:
http://github.com/rubyist/aasm/tree/master
John S. (Guest)
on 2009-02-25 20:35
> It morphed into aasm:
> http://github.com/rubyist/aasm/tree/master
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 S.
Rick (Guest)
on 2009-02-25 20:51
(Received via mailing list)
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 S. <removed_email_address@domain.invalid>
John S. (Guest)
on 2009-02-25 21:11
Rick wrote:

> Check out the README.textile.
>
> On Feb 25, 8:35�am, John S. <removed_email_address@domain.invalid>
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"

Ta

John S.
Szymon N. (Guest)
on 2009-02-25 21:56
(Received via mailing list)
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 S. (Guest)
on 2009-02-26 09:20
>    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

John S.
Robert W. (Guest)
on 2009-02-27 06:05
John S. 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.
This topic is locked and can not be replied to.