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

Conflicting method and event names #60

Closed
pmontrasio opened this issue Jan 2, 2013 · 2 comments
Closed

Conflicting method and event names #60

pmontrasio opened this issue Jan 2, 2013 · 2 comments

Comments

@pmontrasio
Copy link

In a Rails application of mine a model has a state :created with an event :open, :transition_to => :opened declaration.
A method of the model triggers the state change calling open!. That worked well with the 0.8.1 gem but doesn't work anymore with the 0.8.6 one. Instead it ends up calling the open method of open-uri, which happens to have been included somewhere by the framework and has a different number of arguments and returns an error which I saw in the browser.

An easy workaround would be to change the state name to something else but I set "0.8.1" in the Gemfile to be sure I have no other problems I still didn't find out. Furthermore, what if the next version of another gem "steals" one or more of my state names? (inadvertently, obviously, I don't think this is an attack vector). Devising perfectly safe state names is impossible.

The ideal solution is that the Workflow state prevails over any method name. That should make sense because a locally defined workflow should be expected to be in the local scope. Calling a far away method probably violates the least surprise principle.

@dwbutler
Copy link

dwbutler commented Jan 2, 2013

This looks like the same issue as #58.

@geekq, it looks like this change caused lots of problems. Perhaps you would consider merging #58 and creating a new bugfix release soon?

@pmontrasio
Copy link
Author

Yes, it's the same issue. I didn't realize it when I looked at the issue titles in the list.
I'm closing this one as duplicate.

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

No branches or pull requests

2 participants