2
votes

My rails app, Rails 4.2.6, had been working perfectly but, after running the bundle exec rails server command as usual to start my web server for development I got this error message:

DEPRECATION WARNING: The configuration option `config.serve_static_assets`                              
has been renamed to `config.serve_static_files` to clarify its role (it  
merely enables serving everything in the `public` folder and is unrelated 
to the asset pipeline). The `serve_static_assets` alias will be removed in 
Rails 5.0. Please migrate your configuration files accordingly. (called 
from block in <top (required)> at /home/jack/Desktop/Rails/MegsBlog/config
/environments/development.rb:2)

I've tried changing method names in the config files as suggested in other communities and have restarted the server but still no luck, everything in my app works except there are no images which I'm sure is due to the method name changing

2
In the file /home/jack/Desktop/Rails/MegsBlog/config /environments/development.rb there should be on second line the old method name: serve_static_assets you should change it to serve_static_files.DonPaulie
my images are still in /assets/images if that helps, ive tried moving them to the public folder but there is no changeJack Carter

2 Answers

2
votes

This might be late, but I just encountered this issue having set config.serve_static_files = true.
The problem was that I needed to clear the assets pipeline and precompile,so I used this command locally:
rake assets:clean && rake assets:clobber && rake assets:precompile.
Note that you should keep the images and all styles and javascript in app/assets/ and not in public/.

I hope you have solved your problem already, or if not maybe this could help you and others, or you can share with us how you have solved it otherwise. Thanks!

0
votes

After updating the Rails version serve_static_assets method was changed to serve_static_files. Actually it is just a name change so you should not expect any changes of the behaviour of your app. Rename the config without changing its value and the warning will disappear.