Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding callbacks to object breaks ActiveRecord integration #282

Open
SkyWriter opened this issue Oct 3, 2013 · 1 comment · May be fixed by #287
Open

Binding callbacks to object breaks ActiveRecord integration #282

SkyWriter opened this issue Oct 3, 2013 · 1 comment · May be fixed by #287

Comments

@SkyWriter
Copy link

Happens something like this:

StateMachine::Callback.bind_to_object = true

class Vehicle < ActiveRecord::Base
  state_machine :initial => :parked do
    event :ignite do
      transition :parked => :idling
    end
  end
end

Vehicle.new.ignite!

# NoMethodError:
#       undefined method `notify' for #<Vehicle:0x007fc447433768>

Looks like callbacks are mistakenly being called on Vehicle object rather than StateMachine::Machine.

@tyre
Copy link

tyre commented Oct 17, 2013

👍

@tyre tyre linked a pull request Oct 28, 2013 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants