问题
I'm trying to debug my little app failing to create a Price because of an AssociationTypeMismatch. So I dig out pry, install, watch railscast and Josh's screencast and dig into the wiki.
I "cd" into the prices controller but that fails. I've put <% binding.pry %> into the new.html before the submit code but Rails says that the 'pry' method is unknown. pry is in my updated Gemfile and I restarted the server.
I put binding.pry into the create method of my prices_controller.rb and Rails happily breezes through it to throw the error I've already seen, not the pause, etc I was expecting.
Looking at the Price model, I'm not experienced enough to know what I should be looking for. What am I overlooking? thanx, sam
回答1:
I have the exact same problem, my solution was to add pry-remote to my Gemfile, and call binding.remote_pry instead of binding.pry, open the terminal at your current project and execute pry-remote. happy debugging :)
回答2:
It appears that in addition to the pry gem, I need the pry-rails gem as well. Now the binding.pry is recognized.
回答3:
Instead of installing pry-rails you could just require 'pry'
before the binding :-)
来源:https://stackoverflow.com/questions/9135906/binding-pry-ignored-by-rails-3