what's happened to acts_as_state_machine

John Small wrote:

I went to get the latest acts_as_state_machine from GitHub - rubyist/aasm: AASM - State machines for Ruby classes 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

It morphed into aasm:

It morphed into aasm: GitHub - rubyist/aasm: AASM - State machines for Ruby classes

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

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.

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"

Ta

John Small

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

   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 Small