Compiling and Serving Assets (JavaScript/CSS) in Production Environment -Rails 6

In order to server assets in Production environment; assets are first compiled and put into /public/assets directory. So, first you need to run the following command to compile the assets.

RAILS_ENV=production rails assets:precompile

It is encouraged to serve static content using NGINX/Apache. But if you want rails to serve the contents add/modify the following line on production.rb

config.public_file_server.enabled = true

In case you are facing anomaly and confident your code is correct then try clearing the cache using

rails tmp:cache:clear

 150 total views,  1 views today