We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have the following class that defines an event named 'abort'.
class Run < ActiveRecord::Base state_machine :initial => :queued do event :abort do transition any => :aborted end end end
When I try to fire the event, I get the following error:
NoMethodError: private method `abort' called for #<Run:0x007f9480936c70>
This is likely because the abort method is defined in the Kernel module or ruby, and thus is available for any object.
I've made a fork of the repo and reproduced the failure in a unit test.
smathieu@af2c1ff
The text was updated successfully, but these errors were encountered:
You can probably work around this buy using the low level methods.
YourClass.state_machines[:name_of_machine].events[:abort].transition_for(instance_of_your_class).perform(args)
Sorry, something went wrong.
Probably, but that's an horrible hack :)
That's not a hack, it's just not using the instance helper methods, which are an abstraction over the one mentioned.
Alternatively you can remove/undef the method from your class before initializing the state machine.
No branches or pull requests
I have the following class that defines an event named 'abort'.
When I try to fire the event, I get the following error:
This is likely because the abort method is defined in the Kernel module or ruby, and thus is available for any object.
I've made a fork of the repo and reproduced the failure in a unit test.
smathieu@af2c1ff
The text was updated successfully, but these errors were encountered: