-
Notifications
You must be signed in to change notification settings - Fork 899
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
fully qualify the Version class to prevent load-errors #183
fully qualify the Version class to prevent load-errors #183
Conversation
This seems to be the same issue noted in #165. Not certain, but I think a more thorough solution is called for, likely namespacing the I'm curious as to why the Travis build failed for your pull request, because I cloned your code down and ran the test suite and all the tests passed for me. Any ideas? |
@fullbridge-batkins the PR failed to build because of the latest version of capybara. There is a known issue, that the dependencies are not loaded correctly for 2.0.1. A call to I submitted the PR because this solution is simple and fixes broken cases without compromising backwards compatibility. Of course this does not help in the case where a If the other PR is about to be merged and released, I'm fine and this PR can be closed. Otherwise it would be nice to have this one in for the mean time. |
👍 |
@senny - Thanks for the response and the pull request. I think what you're saying makes sense. Can you elaborate a bit more on the use case where you're encountering this issue? When you say I'm just trying to understand for my own knowledge why this change makes it work in a scenario like this. |
We use rails engines heavily. Engines are parts of a rails app, which is namespaced and distributed like a gem. The default generated scaffold of an engine Now imagine the following situation: module MyCoolEngine
class ExampleContext
def run
SomeARModel.create!
end
end
end Let's assume If we prefix the @fullbridge-batkins I hope this explanation is understandable. 😄 |
👍 |
@senny - Thanks a lot for the explanation. That's very helpful and informative! What you're saying makes a lot of sense, I just wanted to understand exactly what the inner workings of this was, so cheers for that! And thanks again for the pull request. 😀 |
We use paper_trail inside engines and this causes load-errors because Rails will load the wrong file for the
Version
class. The exact error is:I patched paper_trail to fully qualify the constant name
"::Version"
this should have no effect on existing applications but fixed the problem for me.