简体   繁体   English

Rails 4和控制器特定资产

[英]Rails 4 and controller specific assets

How to include controller specific assets. 如何包括控制器特定资产。 I have such code in head of layout: 我在布局的头部有这样的代码:

= javascript_include_tag "admin"

and this in body: 并在体内:

= javascript_include_tag params[:controller]

It works OK at developer mode, but not at production. 在开发人员模式下可以正常运行,但在生产环境下则无法正常运行。 What is best pracise for this? 最好的做法是什么?

you need to add all the files to the precompile configuration of your app. 您需要将所有文件添加到应用程序的预编译配置中。

have a look at the guides: http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets 看看指南: http : //guides.rubyonrails.org/asset_pipeline.html#precompiling-assets

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM