我们render inline
在我们的rails 3.2
应用程序中使用:
<%= render inline: @erb_code, locals: {f: f} %>
这里返回一个用于渲染@erb_code
的字符串。ERB code
这个内联的问题是@virtual_path
在渲染中设置为 false,这会refresh(view)
导致ActionView::Template
. 这是错误:
ActionView::Template::Error:
A template needs to have a virtual path in order to be refreshed
这是导致错误的刷新定义中的行:
raise "A template needs to have a virtual path in order to be refreshed" unless @virtual_path
的完整定义refresh(view)
可在http://api.rubyonrails.org/classes/ActionView/Template.html获得。
如何@virtual_path
在 rspec 中设置 true 以避免规范错误?但是代码的执行似乎没有错误。尝试@virtual_path
在规范中分配 true 并且它不起作用。