-
Notifications
You must be signed in to change notification settings - Fork 341
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
Spring binstub error when requiring class from lib/ in application.rb #642
Comments
I tried to repro this, but I couldn't. I get this:
If I manually add |
So @olivierlacan, close it please. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given a file in
lib/
namedthing.rb
which required withinapplication.rb
like this:When
rails server
is launched, I was surprised to see this Spring-related error. I doubt it's truly related to Spring, but I felt like I should at least document this behavior since it may be surprising to some people.The only way I avoid it is by moving the
require
call within theApplication
class definition, which I had to do in the case whereThing
is a Rack middleware I wanted to insert. Although I don't have huge qualms about having to do so, I don't remember specific instructions from the Rails Guides warning against requiring (non reloadable) code outside of theApplication
class definition. But I'll admit I might just be tired.Here's a reproduction app: https://github.com/olivierlacan/rails-6-1-1-lib-require-spring-bug
I did initially follow the instructions to
bundle exec spring binstub --all
but I doubt this issue has anything to do with the Spring version since this is a brand new app whose binstubs are Spring 2.1.1 native.Considering the Stacktrace, this feels more likely to be a Bootsnap bug so I'll gladly move this issue over to that repo if that makes more sense.
The text was updated successfully, but these errors were encountered: