Sergio A. Sergio A. - 2 years ago 96
Ruby Question

Rails 4 - How to access to gem precompiled assets

I have an application an I'm precompiling the assets to deploy to Heroku. I'm using a gem which uses some internal images. I run.

RAILS_ENV=production bundle exec rake assets:precompile

And the images are compiled, in fact i can see them in the
directory (where they should be). E.g.


The problem is the gem's javascript cannot find the images because it's referencing to them internally (). So, I've changed the configuration to add the images using <%= asset_path "filename" %> (I changed the file to
). Locally works ok (because I'm not precompiling in development), but after deploying to heroku, the images are referenced like


Without the md5 fingerprint.

Somebody knows what am I doing wrong? Or there's something I'm missing when precompilng gem assets?


Answer Source

Ok, it seems that asset_path doesn't use the fingerprints for the images. I had to use image_path and tweak a little bit to make it work with the library.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download