1

I want to create a maintanance_mode page in my rails app. So I've created StaticPagesController with maintanance_mode method (it's empty) and views views/static_page/maintanance_mode.html.erb with routes below:

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

I was trying to get into this page (simple Hello) but I've got an error

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:
mr_muscle
  • 2,536
  • 18
  • 61
  • 1
    is there an `application.css` file in the assets\sytlesheets folder? – dbugger Nov 07 '19 at 13:04
  • Error at the top shows code from `application.html.erb`, there is only application.scss in `javascript/src/scenes/base/style/application.scss` – mr_muscle Nov 07 '19 at 13:16
  • this isn't a static page, since it is an erb, so it is using the application layout. if you want a true static page, make it an html page and stick it in /public. Will also need to configure rails to serve static pages. see https://stackoverflow.com/questions/21969549/rails-application-css-asset-not-found-in-production-mode – dbugger Nov 07 '19 at 14:00

1 Answers1

0

The solution was quite simple, I have to add application.css with below code

application.css

/* ...
*= require_self
*= require_tree .
*/
mr_muscle
  • 2,536
  • 18
  • 61