How to properly configure Pry in Rails 4.2

I am confused about which stones to install in order to run Pry correctly in a Rails 4.2 project. Until recently, it seemed to me that everything was in order. For some reason, binding.pry now seems to spit when I try to execute a console session using next , step , etc. At the command line. This will cause an ugly stack trace, and then show me the same point in the code without going further. After the second next command, it issues the same stack trace and exits, returning execution to the localhost server. I get a runtime error on a browser page using No frames collected .

If I comment on binding.pry in my code, everything will be fine. Therefore, I strongly suspect that something is wrong with my Pry configuration. It seems that there are several dozen variations of Pry, without a clear indication on which to establish (s) that may conflict, etc.

Here is the stack trace that I get when I call next in the Pry console after the code reaches the binding.pry call:

 From: /Users/me/sites/arailsapp/app/controllers/bars_controller.rb @ line 31 BarsController#edit: 29: def edit 30: binding.pry => 31: @bar = Bar.find(params[:id]) 32: @foo = @bar.foo 33: end [6] pry(#<BarsController>)> n Completed 500 Internal Server Error in 2685ms (ActiveRecord: 0.0ms) RuntimeError - No frames collected.: pry-byebug (3.2.0) lib/byebug/processors/pry_processor.rb:122:in `perform_next' pry-byebug (3.2.0) lib/byebug/processors/pry_processor.rb:60:in `perform' pry-byebug (3.2.0) lib/byebug/processors/pry_processor.rb:49:in `run' pry-byebug (3.2.0) lib/byebug/processors/pry_processor.rb:111:in `resume_pry' pry-byebug (3.2.0) lib/byebug/processors/pry_processor.rb:69:in `at_line' byebug (5.0.0) lib/byebug/context.rb:90:in `at_line' app/controllers/scholarships_controller.rb:31:in `edit' actionpack (4.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action' actionpack (4.2.1) lib/abstract_controller/base.rb:198:in `process_action' actionpack (4.2.1) lib/action_controller/metal/rendering.rb:10:in `process_action' actionpack (4.2.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action' activesupport (4.2.1) lib/active_support/callbacks.rb:117:in `call' # omitting the next ~40 lines in the Rails stack... 

The second verse looks the same as the first, after which execution returns to the server.

Here is my gemfile:

 source 'https://rubygems.org' ruby '2.2.0' gem 'rails', '4.2.1' gem 'pg', '~> 0.18.2' gem 'haml-rails', '~> 0.9.0' gem 'sass-rails', '~> 5.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2.0' gem 'sdoc', '~> 0.4.0', group: :doc gem 'will_paginate', '~> 3.0.7' gem 'will_paginate-bootstrap' gem "nilify_blanks" gem 'filterrific', '~> 2.0.5' gem 'chardinjs-rails' # Install bootstrap and associated gems gem 'bootstrap-sass', '~> 3.3.4.1' gem 'autoprefixer-rails', '~> 5.2.0' # Use ActiveModel has_secure_password gem 'bcrypt', '~> 3.1.7' group :production do gem 'rails_12factor', '~> 0.0.3' end group :assets do gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.1.0' end group :development do gem 'better_errors', '~> 2.1.1' gem 'annotate', '~> 2.6.10' end group :development, :test do gem 'pry-rails' gem 'pry-stack_explorer' gem 'pry-byebug' gem 'web-console', '~> 2.0' gem 'spring' gem 'spring-commands-rspec', '~> 1.0.4' gem 'rspec-rails', '~> 3.2.3' gem 'guard-rspec', '~> 4.6.0' gem 'sqlite3' gem 'factory_girl_rails', '~> 4.5.0', require: false end group :test do gem 'database_cleaner', '~> 1.4.1' gem 'faker', '~> 1.4.3' gem 'capybara', '~> 2.4.4' gem 'launchy', '~> 2.4.3' gem 'shoulda', '~> 3.5.0' end 

I also tried with pry-stack_explorer and pry-byebug comment ... no difference.

And finally, my .pryrc file:

 # ~/.pryrc if defined?(PryByebug) Pry.commands.alias_command 'c', 'continue' Pry.commands.alias_command 's', 'step' Pry.commands.alias_command 'n', 'next' Pry.commands.alias_command 'f', 'finish' end # Hit Enter to repeat last command Pry::Commands.command /^$/, "repeat last command" do _pry_.run_command Pry.history.to_a.last end 
+5
source share
1 answer

Some startup problems and a few server restarts seem to fix the problem. Thanks to Deivid for offering to abandon pry-stack_explorer . Here's the gemfile for test and development teams:

 group :development do gem 'better_errors', '~> 2.1.1' gem 'annotate', '~> 2.6.10' end group :development, :test do gem 'pry-rails' gem 'pry-byebug' gem 'web-console', '~> 2.0' gem 'spring' gem 'spring-commands-rspec', '~> 1.0.4' gem 'rspec-rails', '~> 3.2.3' gem 'guard-rspec', '~> 4.6.0' gem 'sqlite3' gem 'factory_girl_rails', '~> 4.5.0', require: false end group :test do gem 'database_cleaner', '~> 1.4.1' gem 'faker', '~> 1.4.3' gem 'capybara', '~> 2.4.4' gem 'launchy', '~> 2.4.3' gem 'shoulda', '~> 3.5.0' end 
+2
source

All Articles