Closed saurabhnanda closed 11 years ago
Maybe this is a side-effect of using continuations for the around callbacks?
So, it is a bug and not something stupid from my end?
http://www.saurabhnanda.com On 1 Feb 2013 18:45, "the8472" notifications@github.com wrote:
Maybe this is a side-effect of using continuations for the around callbacks?
— Reply to this email directly or view it on GitHubhttps://github.com/pluginaweek/state_machine/issues/230#issuecomment-12993536.
I think this is simply wonky behavior of ensure blocks in the presence of continuations. See https://github.com/rubinius/rubinius/blob/master/spec/ruby/shared/continuation/call.rb#L35
Any advantage of using continuations vs blocks within state_machine?
On Sat, Feb 2, 2013 at 5:20 PM, the8472 notifications@github.com wrote:
I think this is simply wonky behavior of ensure blocks in the presence of continuations. See https://github.com/rubinius/rubinius/blob/master/spec/ruby/shared/continuation/call.rb#L35
— Reply to this email directly or view it on GitHubhttps://github.com/pluginaweek/state_machine/issues/230#issuecomment-13028278.
Also, are only around_transition implemented through continuations? What about before & after transition.
before and after are called in a plain loop, I think.
Indeed this was an issue with the use of continuations. However, the fact that state_machine was using a continuation in the first place was a bug in this case. I've updated the ORM integrations to fix this issue -- with the upcoming 1.2.0 release you should no longer see this under most circumstances.
Thanks for reporting this issue and @the8472 thanks for the suggested workarounds!
Thank you for fixing this :-)
Hi,
I'm vexed by extremely weird behaviour while using
around_transition
andaround_save
on the same model. It could be that this is not a bug, and I'm missing something extremely simple - please pardon me in that case. However, to the best of my understanding, this seems to be some bug somewhere.Here's a PoC code which produces this bug.
Note: RequestStore is a Gem which allows you to keep stuff in
Thread.current
safely.I would expect the following output during a state transition (in the following examples the event is, say 'activate'):
However, the actual output is:
Any clue as to what could be going wrong? Am I doing something really stupid here?
I've made a quick Rails app with the PoC code at https://github.com/saurabhnanda/test_state_machine You can create this output by
rails r lib/test_script.rb