Hi David,
Thanks for your detailed response.
I tried both of your suggestions and I'm still getting Stack Level Too
Deep.
Also note that I have to use transition.object in each state to access
object:
state :purchased do
on_entry { JobNotifier.send_later(:deliver_pending_approval,
transition.object, transition.object.company) }
event :approve, :to => :approved
end
I can do this with the states block too, but that still produces the
stack error. It does not like being saved!
I tested in both Rails 2.3.2 and 2.3.4.
I see that it uses method_missing to catch the save! action. This is
at the top of the stack trace:
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
support/core_ext.rb:66:in `method_missing'
and then below:
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
executioner.rb:75:in `evaluate_with_arguments'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
support/core_ext.rb:74:in `with_methods_on'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
executioner.rb:74:in `evaluate_with_arguments'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
executioner.rb:81:in `evaluate'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
transition.rb:305:in `evaluate'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
transition.rb:158:in `run_hook'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
transition.rb:193:in `fire!'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
transition.rb:189:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
transition.rb:189:in `fire!'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
transition.rb:184:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
transition.rb:184:in `fire!'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
binding.rb:92:in `fire_transition!'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
method_factory.rb:34:in `purchase!'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
method_factory.rb:168:in `__send__'
from /opt/local/lib/ruby/gems/1.8/gems/davidlee-state-fu-0.12.1/lib/
method_factory.rb:168:in `method_missing'
Thanks for your help.