Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails 4 enabled rails to serve static assets: is it correct? (on heroku)

Environment: heroku

Rails: 4

Ruby: 2

We deployed an app to heroku, and it seemed as though anything in the public folder was not accessible (didn't see the static file so the router kicked in and then complains about no route matching).

To get around this, we set

# Rails 4 only flag config.serve_static_assets = true 

in our production.rb file. Is this really the best way to handle this? Or did we fail to configure the app some how to be hosted on heroku properly?

like image 666
Mike Avatar asked Jul 09 '13 14:07

Mike


People also ask

How do I Precompile assets in Heroku?

To compile your assets locally, run the assets:precompile task locally on your app. Make sure to use the production environment so that the production version of your assets are generated. A public/assets directory will be created. Inside this directory you'll find a manifest.


1 Answers

This is deprecated in Rails 4.2, and it is now an alias slated to be removed in Rails 5.0

config.serve_static_assets = true 

It should be changed to:

config.serve_static_files = true 
like image 184
Loren Avatar answered Sep 28 '22 04:09

Loren