I'm starting in rails and I've got an application that is working in dev (webrick).
The problem is: the precompiled CSS file is not found in production.
Now I host it on heroku and deploy it. I have a message saying that assets are precompiled (so it's not a compilation error) and everything is by-default for settings.
I've ls the /public/assets folder and everything is in there. I can even cat
the application-*.css file and I get the full content I should have.
Now when I try to access the CSS file it gives me an error 404 (even tho it's an auto-generated css link using <%= stylesheet_link_tag "application", :media => "all" %>
). So definetly it's not a problem that I did hardcode the CSS link.
I'm not exactly sure on what would be the next check to perform.
If you're curious on the output, it is currently publicly accessible here.
Try changing the configuration option config.serve_static_assets = false
to config.serve_static_assets = true
in your config/environments/production.rb
if you haven't already done that.
The only thing that fixed it for me in Rails 4 was
config.assets.compile = true
in config/environments/production.rb
This would fall back to the assets pipeline if a precompiled asset is missed, according to the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With