[英]Ruby on Rails routes prefixes not pre-processing in .erb.js file
[英]Does Rails 4 allow ruby code in a .JS view, in rails 3 it was required to have .erb.js in the filename
Rails 4是否允许在.JS视图中使用ruby代码,在Rails 3中要求文件名中包含.erb.js
def test
respond_to do |format|
format.js { Rails.logger.info "in JS handler" }
end
end
/app/views/users/test.erb.js <== no longer works in rails 4
和
/app/views/users/test.js <== still works in rails 4 but does it allow ruby inside this file?
您的文件必须命名为test.js.erb
才能在其中包含Ruby代码。
问题是文件必须命名
file.js.erb
不
file.erb.js
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.