我可以使用binding.pry在本地调试应用程序就好了.但我也需要在远程服务器(网站)上,因为在本地我没有任何错误,但在生产我做.所以把binding.pry放在服务器上的源文件中,当我向网站发出帖
它是一个开发服务器,所以它在互联网上可见,但它是一个开发人员服务器,虽然对于rails它的生产,因为RAIL_ENV等于生产.我真的需要以我在本地使用pry的方式进行调试.我该怎么做?
更新:
# bundle exec pry-remote /usr/lib/ruby/1.9.1/drb/drb.rb:736:in `rescue in block in open': druby://127.0.0.1:9876 - #<Errno::ECONNREFUSED: Connection refused - connect(2)> (DRb::DRbConnError) from /usr/lib/ruby/1.9.1/drb/drb.rb:730:in `block in open' from /usr/lib/ruby/1.9.1/drb/drb.rb:729:in `each' from /usr/lib/ruby/1.9.1/drb/drb.rb:729:in `open' from /usr/lib/ruby/1.9.1/drb/drb.rb:1191:in `initialize' from /usr/lib/ruby/1.9.1/drb/drb.rb:1171:in `new' from /usr/lib/ruby/1.9.1/drb/drb.rb:1171:in `open' from /usr/lib/ruby/1.9.1/drb/drb.rb:1087:in `block in method_missing' from /usr/lib/ruby/1.9.1/drb/drb.rb:1105:in `with_friend' from /usr/lib/ruby/1.9.1/drb/drb.rb:1086:in `method_missing' from /web/my_site.com/releases/201501271120/vendor/bundle/ruby/1.9.1/gems/pry-remote-0.1.8/lib/pry-remote.rb:289:in `run' from /web/my_site.com/releases/201501271120/vendor/bundle/ruby/1.9.1/gems/pry-remote-0.1.8/bin/pry-remote:4:in `<top (required)>' from /web/my_site.com/releases/201501271120/vendor/bundle/ruby/1.9.1/bin/pry-remote:19:in `load' from /web/my_site.com/releases/201501271120/vendor/bundle/ruby/1.9.1/bin/pry-remote:19:in `<main>'我假设您的生产应用程序由某种守护程序的应用程序服务器运行,例如Puma或Unicorn.
在此设置中,pry-remote可以提供帮助.
>将其添加到您的Gemfile中
>使用binding.remote_pry而不是binding.pry
>在您的服务器上执行bundle exec pry-remote
一旦断点被击中,你就会得到一个撬壳.