Pry is quite amazing in my R3 app. But any chance I can use
<% binding.pry %>
in a view or a partial like I did previously with
<% debugger %>
This doesn't seem to work. Thanks.
Pry is quite amazing in my R3 app. But any chance I can use
<% binding.pry %>
in a view or a partial like I did previously with
<% debugger %>
This doesn't seem to work. Thanks.
It's always worked for me... you might need to require it.
<% require 'pry'; binding.pry %>
<% binding.pry %>
works well.
It doesn't work only if you didn't install pry-rails gem in your rails app.
Please post the error that you are facing if use <% binding.pry %>
such that I can elaborate it more.
I realize this question is now dated, but wanted to raise one other possibility here. It is also possible that your app is breaking before reaching the line of code in which you've placed <%binding.pry%>
. If you are not hitting pry (and have confirmed that it is in your Gemfile and that you've run bundle install
), consider moving <%binding.pry%>
a few lines higher up in your code. If you still do not hit it, consider repeating this process. If you've worked your way to the first line of the view and still aren't hitting pry, try working backward to the controller action that controls rendering this view. If pry is indeed bundled, a common reason for not hitting pry is the app breaking. Again, posting the error here always helps.
Or even better, I like to pass in PRY as an environmental var so I don't have to delete all the requires!
<% binding.pry %>
&&
$ PRY=true rails s
© 2022 - 2024 — McMap. All rights reserved.