pry-rails: reload! - undefined method

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.

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 17 (3 by maintainers)

Commits related to this issue

Most upvoted comments

# .pryrc checked into my project root
require 'rails/console/app'
include Rails::ConsoleMethods

Reload workaround is as follows:

~/.pryrc

if 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

that did the trick @deadlyicon 👍