Marco Mastrodonato
2009-May-15 11:06 UTC
act_as_state_machine (or aasm) to manage integer state?
I have already done my model and i have managed state with an external table where with paperclip i appended an icon for every state. But now i have some trouble with aasm, it seems it can''t use integer value as state, does anyone have had some similar case? aasm_column :state_id aasm_initial_state :"1" #To print aasm_state :"1" #To print aasm_state :"2" #Waiting aasm_state :"3" #Selected i''ve also tried to use something like this but naturally when i attempt to use transaction to change state i get an error aasm_column :state_id aasm_initial_state :"1" #To print aasm_state :"1" #To print aasm_state :"2" #Waiting aasm_state :"3" #Selected when i attempt to use transaction to change state i get this error: You have a nil object when you didn''t expect it! The error occurred while evaluating nil.name D:/Marco/Progetti/Ruby/Rails232/Sviluppo/eMissive/vendor/plugins/rubyist-aasm-baceb4b53e296cd45ac3acbd5df291e14b2993aa/lib/state.rb:14:in `=='' D:/Marco/Progetti/Ruby/Rails232/Sviluppo/eMissive/vendor/plugins/rubyist-aasm-baceb4b53e296cd45ac3acbd5df291e14b2993aa/lib/aasm.rb:123:in `aasm_state_object_for_state'' C:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.3.1/lib/ruby-debug/command.rb:119:in `find'' D:/Marco/Progetti/Ruby/Rails232/Sviluppo/eMissive/vendor/plugins/rubyist-aasm-baceb4b53e296cd45ac3acbd5df291e14b2993aa/lib/aasm.rb:123:in `each'' D:/Marco/Progetti/Ruby/Rails232/Sviluppo/eMissive/vendor/plugins/rubyist-aasm-baceb4b53e296cd45ac3acbd5df291e14b2993aa/lib/aasm.rb:123:in `find'' D:/Marco/Progetti/Ruby/Rails232/Sviluppo/eMissive/vendor/plugins/rubyist-aasm-baceb4b53e296cd45ac3acbd5df291e14b2993aa/lib/aasm.rb:123:in `aasm_state_object_for_state'' D:/Marco/Progetti/Ruby/Rails232/Sviluppo/eMissive/vendor/plugins/rubyist-aasm-baceb4b53e296cd45ac3acbd5df291e14b2993aa/lib/aasm.rb:129:in `aasm_fire_event'' D:/Marco/Progetti/Ruby/Rails232/Sviluppo/eMissive/vendor/plugins/rubyist-aasm-baceb4b53e296cd45ac3acbd5df291e14b2993aa/lib/aasm.rb:62:in `review!'' D:/Marco/Progetti/Ruby/Rails232/Sviluppo/eMissive/app/controllers/admin/letters_controller.rb:195:in `print'' D:/Marco/Progetti/Ruby/Rails232/Sviluppo/eMissive/app/controllers/admin/letters_controller.rb:176:in `print'' -- Posted via http://www.ruby-forum.com/.
Marco Mastrodonato
2009-May-19 07:21 UTC
Re: act_as_state_machine (or aasm) to manage integer state?
Doesn''t anyone know how to do or if exist a fork which is able to do this? It''s a pity to don''t use this helpful plugin and was perfect for my purpose -- Posted via http://www.ruby-forum.com/.