创建新页面ActionView :: Template :: Error后出现Rails错误(资产管道中不存在资产“ application.css”

时间:2019-11-07 12:44:07

标签: ruby-on-rails ruby

我想在Rails应用程序中创建一个maintanance_mode页面。因此,我使用StaticPagesController方法创建了maintanance_mode(它为空),并使用以下路由查看了views/static_page/maintanance_mode.html.erb

Rails.application.routes.draw do
  root to: 'react#index',
  get: '/maintanance_mode', to: 'static_pages#maintanance_mode'

  scope 'api' do
    use_doorkeeper do
      skip_controllers :applications, :authorized_applications, :authorizations
    end
  end

我试图进入此页面(简单的Hello),但出现错误

ActionView::Template::Error (The asset "application.css" is not present in the asset pipeline.):
     8:     <%= csrf_meta_tags %>
     9:     <%= csp_meta_tag %>
    10:
    11:     <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    12:     <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
    13:   </head>
    14:

1 个答案:

答案 0 :(得分:0)

解决方案非常简单,我必须使用以下代码添加application.css

application.css

/* ...
*= require_self
*= require_tree .
*/