I have a rails engine gem that has image_x.jpg in it. I tried to override that image with the one I have locally in my project by adding it to the assets & public directories.
Rails, however, continues to show the image from the gem file rather than my local file.
If I monkeypatch the gem and remove the image image_x.jpg then the image from my local project appears, but this is less than ideal.
Is there a way to tell rails to serve the image from my local project rather than the one in the gem?
In other-words, is there a way to prioritize local assets over the gem file assets?
By default, Rails should be using your local image_x.jpg.
To check the order that Rails will search for assets, open your console and type:
Rails.application.config.assets.paths
You should be able to verify that your app/assets directory appears before the gem's assets directory in the search PATH. If not, something may be modifying your asset path.
If your asset path looks wrong, you can easily modify it. (It's just an Array of Strings.) To add a new highest-priority directory, try adding something like this to an initializer:
Rails.application.config.assets.paths.unshift "/some/other/path"
Also try deleting tmp/cache/assets
and restarting your server.