example code fails
-
Matt Hodgson
Ditto on this. Can't get it to include for the life of me. Tried it every way I can think of.
-
Scott Barron
Hi,
Can you guys tell me a little about your set up and give some specific examples of what's failing? Here's what I've got that's working for me:
~ > sudo gem install rubyist-aasm
Successfully installed rubyist-aasm-2.0.2
1 gem installed
Installing ri documentation for rubyist-aasm-2.0.2...
Installing RDoc documentation for rubyist-aasm-2.0.2...
~ > irb
>> require 'rubygems'
=> false
>> require 'aasm'
=> true
>> class Conversation
>> include AASM
>> aasm_initial_state :new
>> aasm_state :new
>> aasm_state :read
>> aasm_event :view do
?> transitions :to => :read, :from => [:new]
>> end
>> end
=> #
>> Conversation.new.view!
=> true
-
todd (at snappl)
I'm getting this as well.
In my environment.rb:
require 'aasm'
Rails::Initializer.run do |config| ... config.gem "rubyist-aasm", :lib => "aasm", :source => "http://gems.github.com", :version => '2.0.5'
In my model:
class User < ActiveRecord::Base
include AASM aasm_initial_state :pendingin my spec:
it "should start in pending state" do
g = User.create(@valid_attributes) g.pending?.should_be trueend
error when I run the spec:
undefined method
aasm_state' for #<User:0x22fc6bc>Environment OSX 10.5.6, Rails 2.2.2, Ruby 1.8.6 from macports. Many gems installed, but right now only requiring haml 2.0.7 concomitantly. Never been able to make aasm work on any project, and so have always used acts_as_state_machine, but now cannot get it installed owing to a refusal to contact the errtheblog subversion server.
-
todd (at snappl)
Oh, yeah, forgot, if I add
aasm_state :pending
to the User model, nothing happens, same error.
-
todd (at snappl)
Got it. I froze the gem in to vendor/gems and added:
aasm_column :state
(surely that's the default)
to my model. However, @user.current_state does not work, it will only work with the more verbose @user.aasm_current_state. Also the lovely, concise @user.pending? @user.active?, etc. methods available in acts_as_... are either gone or not working.
Please don't take this the wrong way, but overall aasm feels a bit unfinished in contrast with acts_as_state_machine.
-
todd (at snappl)
Sorry, disregard that last comment (at least most of it): @user.pending? .active? etc. are working. I was being stoopid.
Would still like to see a default column name, however.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
