0

My Rails app can't find precompiled images from gems in production. All other assets are working as is all assets in development. I get the following error when running in production mode;

ActionController::RoutingError (No route matches [GET] "/assets/dataTables/sort_asc.png"):

The assets seem to precompiled properly, images from app/assets/images show up.

Can someone shed some light on the problem?

SteveO7
  • 2,430
  • 3
  • 32
  • 40

1 Answers1

1

Recompiling assets worked for me.

remove public/assets

1.rake assets:clobber RAILS_ENV=production

assets compile

2.rake assets:precompile RAILS_ENV=production

3.restart server,eg(nginx)

credit to albert.qing's answer here

I might add that I am using docker so I added this step towards the end of my docker file

/Dockerfile

FROM ruby:2.2.3-slim
.
.
.
# Precompile Rails assets
RUN bundle exec rake assets:clobber RAILS_ENV=production
RUN bundle exec rake assets:precompile RAILS_ENV=production
.
.
.
Community
  • 1
  • 1
SteveO7
  • 2,430
  • 3
  • 32
  • 40