2016-12-03 56 views
3

我是新来Rails 5.0.0.1资产并没有宣布在产品中预编译(Rails的5.0.0.1)

我跟着http://guides.rubyonrails.org/asset_pipeline.html#controller-specific-assets准则:

You can also opt to include controller specific stylesheets and JavaScript files only in their respective controllers using the following:

<%= javascript_include_tag params[:controller] %> or <%= stylesheet_link_tag params[:controller] %>

When doing this, ensure you are not using the require_tree directive, as that will result in your assets being included more than once.

我产生了一些支架(这也产生了资产 - .coffee.scss

当我做rails s和支架主页的访问之一,它产生一个错误:

Asset was not declared to be precompiled in production.

Add Rails.application.config.assets.precompile += %w(myscaffold.css) to config/initializers/assets.rb and restart your server


我,因为它说,它的工作,但有任何其他方式来简化这个过程

我希望我可以用他们的资产生成一些其他脚手架或控制器,而不用再在config/initializers/assets.rb内添加新行。

我也会收到其他的选择。

回答

4

你只是尝试这个..

检查Gemfile​​3210

而且bundle install

+0

,它的工作@karthick。 我使用的是'3.2.0'版本。 请问为什么它应该是'2.3.3'版本? 并且非常感谢 –

+0

我在最后一个项目上使用了这个版本..你的更新也可以把version.that不是问题.. –

+0

这样做。如何spambiscuit有人应该是有生产力,而不使用动态编译动态资产链接,我不知道... –