what's happened to acts_as_state_machine

已查看 21 次
跳至第一个未读帖子

John Small

未读,
2009年2月25日 10:12:082009/2/25
收件人 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

未读,
2009年2月25日 12:30:152009/2/25
收件人 rubyonra...@googlegroups.com

John Small

未读,
2009年2月25日 13:35:542009/2/25
收件人 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

未读,
2009年2月25日 13:50:052009/2/25
收件人 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

未读,
2009年2月25日 14:11:222009/2/25
收件人 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

未读,
2009年2月25日 14:56:102009/2/25
收件人 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

未读,
2009年2月26日 02:20:132009/2/26
收件人 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

未读,
2009年2月26日 23:05:272009/2/26
收件人 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.

回复全部
回复作者
转发
0 个新帖子