使用绑定。在Rails应用程序的视图或部分

时间:2022-08-16 20:40:53

Pry is quite amazing in my R3 app. But any chance I can use

在我的R3应用程序中,Pry是很神奇的

<% binding.pry %> 

in a view or a partial like I did previously with

在某种程度上,或者像我之前做的那样。

<% debugger %>

This doesn't seem to work. Thanks.

这似乎行不通。谢谢。

3 个解决方案

#1


22  

It's always worked for me... you might need to require it.

这对我来说总是有用的……你可能需要它。

<% require 'pry'; binding.pry %>

#2


3  

<% binding.pry %> works well.

< %绑定。撬% >行之有效。

It doesn't work only if you didn't install pry-rails gem in your rails app.

只有在你的rails应用程序中没有安装pry-rails gem时,它才会工作。

Please post the error that you are facing if use <% binding.pry %> such that I can elaborate it more.

如果使用<%绑定,请发布您所面临的错误。pry %>,以便我能更详细地说明它。

#3


0  

Or even better, I like to pass in PRY as an environmental var so I don't have to delete all the requires!

或者更好的是,我喜欢将PRY作为环境变量传递,这样我就不必删除所有的需求!

<% binding.pry %>

&&

& &

$ PRY=true rails s

#1


22  

It's always worked for me... you might need to require it.

这对我来说总是有用的……你可能需要它。

<% require 'pry'; binding.pry %>

#2


3  

<% binding.pry %> works well.

< %绑定。撬% >行之有效。

It doesn't work only if you didn't install pry-rails gem in your rails app.

只有在你的rails应用程序中没有安装pry-rails gem时,它才会工作。

Please post the error that you are facing if use <% binding.pry %> such that I can elaborate it more.

如果使用<%绑定,请发布您所面临的错误。pry %>,以便我能更详细地说明它。

#3


0  

Or even better, I like to pass in PRY as an environmental var so I don't have to delete all the requires!

或者更好的是,我喜欢将PRY作为环境变量传递,这样我就不必删除所有的需求!

<% binding.pry %>

&&

& &

$ PRY=true rails s