2016-12-03 58 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有人應該是有生產力,而不使用動態編譯動態資產鏈接,我不知道... –