-
Notifications
You must be signed in to change notification settings - Fork 91
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
'Event' naming collision #123
Comments
I found two ways so far:
has_many :events
include ActiveModel::Transitions
Would love to hear your input. |
I think that's a bad hack like everything that relies on ordering. But you probably agree with that already.:)
I think that's better but still not optimal. You can do: def event_fired(current_state, new_state, event)
::Event.create!(type: "s.#{event}", transfer: self)
end I just tested it and this works for me. Also, I think this is the ruby-idiomatic way of solving this problem. Let me know if this works for you and what you think of this solution, then I'll update the README to make this easier for others in the future. |
Ahh, I didn't know you could refer to the top-level Event object in the namespace in that way, that's neat! Thanks for the help! |
Addendum: I updated the README to make this clearer to everybody: 883dc00 |
I have an Event model in my Rails project and I do this:
with this, it throws
undefined method 'create!' for Transitions::Event:Class
. It seems it tries to useTransitions::Event
instead of myEvent
model.Is there any clean way to fix this?
The text was updated successfully, but these errors were encountered: