pluginaweek / state_machine

Adds support for creating state machines for attributes on any Ruby class
http://www.pluginaweek.org
MIT License
3.74k stars 507 forks source link

before_transition works, after_transition fails on Rails 4/Mongoid #277

Closed nofxx closed 8 years ago

nofxx commented 11 years ago

Lost some time on this one... only here? As 'fails' I mean wont run, tryed some raise() there and nothing happens.

class Order
  include Mongoid::Document

  state_machine :state, :initial => :created do

    before_transition :on => :pay do |o|
    #... WORKS!

    after_transition :on => :pay do |o|
    # ... NOTHING

  end
end

Rails 4, Mongoid 4

mensfeld commented 11 years ago

+1

aganov commented 11 years ago

+1 Anyone got any idea how to quick fix this?

tagrudev commented 11 years ago

+1

aganov commented 11 years ago

Somehow this commit is breaking the after_transition callback https://github.com/mongoid/mongoid/commit/8c23304dcb56e3c2830f8e1f98b0ad01a7f8c3da

we4tech commented 10 years ago

hi @aganov is it still pending pull request ? I just stucked with the same issue. after_transition doesn't fire up. Can we get it merged ?

Erol commented 10 years ago

@aganov @pluginaweek Any chance that this will get merged soon?

kylemacey commented 10 years ago

+1

thijsc commented 10 years ago

Also ran into this bug, would be great to get a fix merged.

thijsc commented 10 years ago

@aganov @pluginaweek Is there any way I can help getting this fixed?

aganov commented 10 years ago

@thijsc https://github.com/aganov/state_machine/commit/88e45a1b1622d7748933bc941e7e9b08b3045a94

thijsc commented 10 years ago

@aganov I've confirmed that that fix works, but the pull is probably not mergable yet since there's no test for the fix. I'd be happy to see if I can help with that?

momelnyk commented 10 years ago

+1 for tests and merge

thijsc commented 10 years ago

If somebody creates a good pull request for this, will it get merged? Mongoid 4 release is getting pretty close and it would be good to have this in an official release.

cc @aganov @pluginaweek

yudho commented 10 years ago

I could reproduce the same behavior. Before transition is working, while after is not called. Really appreciate for the fix.

localredhead commented 10 years ago

+1 please

helmerj commented 10 years ago

+1

max-konin commented 9 years ago

+1

gemtainers commented 9 years ago

Have an idea about mainaining #331

mvleo-github commented 8 years ago

+1

aganov commented 8 years ago

This repository isn't supported anymore... Consider using https://github.com/state-machines/state_machines-mongoid instead

mensfeld commented 8 years ago

@aganov then maybe you should mark it in readme as open for adoption

nofxx commented 8 years ago

Thanks @aganov. Also, another option is 'AASM'.

aganov commented 8 years ago

@mensfeld I'm not the author of this gem, latest commit is from May 7, 2013 @nofxx yes AASM is good too, but state-machines/state_machines-mongoid is a drop in replacement...

mensfeld commented 8 years ago

@aganov true - sorry @obrie - my question is for you then I assume