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

binding.pry from within rails doesn't reload! (Rails 5.1.4 / ruby 2.4.2p198) #1743

Closed
jm3 opened this issue Feb 8, 2018 · 2 comments
Closed

Comments

@jm3
Copy link

jm3 commented Feb 8, 2018

I've reviewed the docs, the wiki, and stack overflow posts, but am still baffled. Maybe I missed something obvious:

I've bundled pry-rails (0.11.3), which bundles pry(0.10.4). rails c correctly invokes pry, but calling binding.pry from within Rails, e.g. from with a test, invokes pry, but reload! does not work:

NoMethodError: undefined method `reload!' for SolventLayerCache:Class
Did you mean?  load

Does pry have some alternate invocation besides binding.pry that I'm supposed to be using from within my code that will allow whatever Rails / IRB magic makes reload! work?

@rf-
Copy link
Member

rf- commented Feb 8, 2018

Recent versions of Rails (like ones from the last few years, at least) only mix in reload! and friends in the top-level REPL context, as opposed to mixing them into Object, which means they won't be available if you have a binding.pry session in the context of a specific class. You might be able to make it work by running extend Rails::ConsoleMethods after starting the session (possibly after running require "rails/console/app" and require "rails/console/helpers"). If that doesn't help then feel free to open an issue on pry-rails and we could discuss ways of making this easier.

@rf- rf- closed this as completed Feb 8, 2018
@jm3
Copy link
Author

jm3 commented Feb 8, 2018

Got it, thanks for the quick answer!

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