Act_as_state_machine (or aasm) to manage integer state?


#1

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:inaasm_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:ineach’
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:inaasm_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:inreview!’
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:inprint’


#2

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