rails 3.1.0 ActionView::Template::Error (application.css isn't precompiled)

前端 未结 14 1730
自闭症患者
自闭症患者 2020-11-27 09:02

I made a basic rails app with a simple pages controller with an index function and when I load the page I get:

ActionView::Template::Error (application.css i         


        
14条回答
  •  猫巷女王i
    2020-11-27 09:35

    By default Rails assumes that you have your files precompiled in the production environment, if you want use live compiling (compile your assets during runtime) in production you must set the config.assets.compile to true.

    # config/environments/production.rb
    ...
    config.assets.compile = true
    ...
    

    You can use this option to fallback to Sprockets when you are using precompiled assets but there are any missing precompiled files.

    If config.assets.compile option is set to false and there are missing precompiled files you will get an "AssetNoPrecompiledError" indicating the name of the missing file.

提交回复
热议问题