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

Breaks rails console when is used with pry v0.13.0+ #674

Closed
Hirurg103 opened this issue Apr 20, 2020 · 1 comment · Fixed by #677
Closed

Breaks rails console when is used with pry v0.13.0+ #674

Hirurg103 opened this issue Apr 20, 2020 · 1 comment · Fixed by #677

Comments

@Hirurg103
Copy link

Hirurg103 commented Apr 20, 2020

After I upgraded pry to v0.13.0 any operation in the pry console fails with undefined local variable or method '_pry_':

# rails console
binding.pry
1 + 1
(pry) output error: #<NameError: undefined local variable or method `_pry_' for #<Pry::Pager:0x00007faf8647a5f8>

Full backrace is:

~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/zeus-0.15.14/lib/zeus/pry.rb:7:in `best_available'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/pager.rb:34:in `open'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/color_printer.rb:12:in `default'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/pry_instance.rb:302:in `call'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/pry_instance.rb:302:in `show_result'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/pry_instance.rb:672:in `block in handle_line'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/pry_class.rb:382:in `critical_section'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/pry_instance.rb:671:in `handle_line'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/pry_instance.rb:261:in `block (2 levels) in eval'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/pry_instance.rb:260:in `catch'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/pry_instance.rb:260:in `block in eval'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/pry_instance.rb:259:in `catch'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/pry_instance.rb:259:in `eval'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/repl.rb:77:in `block in repl'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/repl.rb:67:in `loop'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/repl.rb:67:in `repl'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/repl.rb:38:in `block in start'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/input_lock.rb:61:in `__with_ownership'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/input_lock.rb:78:in `with_ownership'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/repl.rb:38:in `start'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/repl.rb:15:in `start'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.13.0/lib/pry/pry_class.rb:191:in `start'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.2/lib/rails/commands/console/console_command.rb:70:in `start'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.2/lib/rails/commands/console/console_command.rb:19:in `start'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.2/lib/rails/commands/console/console_command.rb:102:in `perform'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.2/lib/rails/command/base.rb:69:in `perform'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.2/lib/rails/command.rb:46:in `invoke'
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.2/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'

pry-rails causes rails console to open pry and therefore breaks the console

Gem versions:
pry : 0.13.0+
zeus: 0.15.14

@mcmire
Copy link

mcmire commented May 17, 2020

Just ran into this as well. You can get around this issue by adding this patch to the top of your custom_plan.rb:

class Pry::Pager
  def best_available
    NullPager.new(pry_instance.output)
  end
end

mcmire added a commit to thoughtbot/shoulda-matchers that referenced this issue Jul 12, 2020
mcmire added a commit to thoughtbot/shoulda-matchers that referenced this issue Jul 12, 2020
mcmire added a commit to thoughtbot/shoulda-matchers that referenced this issue Jul 12, 2020
mcmire added a commit to thoughtbot/shoulda-matchers that referenced this issue Jul 12, 2020
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

Successfully merging a pull request may close this issue.

2 participants