-
Notifications
You must be signed in to change notification settings - Fork 89
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
reload! - undefined method #9
Comments
same problem. please document a workaround or add these helpers. Thanks. |
A short term fix is to do this in the console: self.send(:include, Rails::ConsoleMethods) I have a pull request coming which does this as well....although it feels a little dirty. |
Is there a way to add this to the 'rails c' startup sequence? Now I'ḿ copy-pasting this everytime... |
@Tomtomgo - Grab the latest version of the gem. The fix has been merged in. |
Nice one. |
I'm still seeing a problem : (Win7 mingw, pry 0.9.10) [4] pry(main)> reload |
Same problem here.... |
Same problem |
Same problem on Rails 3.2, Ruby 2.1.1 :( |
In addition to the possibility that this is a bug, there are a couple of non-bug reasons this could be happening to you. First of all, the helpers are only available if you run Another potential reason they might not be there is if you've BTW, I feel like either of those decisions could be revisited if people want the extra convenience in exchange for monkey-patching If anyone in this thread is seeing this problem and the reasons above don't apply, please leave some extra details about what you're doing so that we can try to track down what's going on. |
Thanks @rf-, that clarifies a lot of things! I was pretty confused when Also, I think the initiative to consider changing this behaviour is great. Maybe it should have its own issue however, so as not to hijack this discussion? |
I'd consider that for another issue. If you're in a Rails app, chances are high that you probably want to have everything loaded in as well. |
Reload workaround is as follows: ~/.pryrcif defined?(Rails) && Rails.env
if defined?(Rails::ConsoleMethods)
include Rails::ConsoleMethods
else
def reload!(print=true)
puts "Reloading..." if print
ActionDispatch::Reloader.cleanup!
ActionDispatch::Reloader.prepare!
true
end
end
end |
thanks @umuro . |
# .pryrc checked into my project root
require 'rails/console/app'
include Rails::ConsoleMethods |
that did the trick @deadlyicon 👍 |
Using pry-rails (0.1.2) causes reload! to no longer work in Rails 3.2. with Ruby 1.9.3.
If I remove the pry-rails gem and use irb, it works as expected.
Exact Message:
Loading development environment (Rails 3.2.0)
[1] pry(main)> reload!
NoMethodError: undefined method `reload!' for main:Object
Thanks,
Scott
P.S. I also noticed the app variable is no longer available.
The text was updated successfully, but these errors were encountered: