Chakreshwar Sharma
Chakreshwar Sharma

Reputation: 2610

Unable to load the assets in production in rails5

I am using Rails 5 , I have changed the application.html.erb to login.html.erb & make the corresponding changes in assets.rb. My application works fine in development environment, but when I run it in production, the css & js are not loading. I have executed rails assets:precompile first, but it doesn't works, So is it really needed to have application layout in the rails5?

Upvotes: 0

Views: 87

Answers (1)

Chakreshwar Sharma
Chakreshwar Sharma

Reputation: 2610

I found a solution for my question. To make , it work I have to add 'rails_12_factor' gem in my gemfile. Basically, rails5 added all its functionality except rails_serve_static_assets which is required in production.rb

config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

If I don't want to add this , then I have to set the above settings as true to make it work.

Layout with different name is working.

Upvotes: 2

Related Questions