Reputation: 47
I am referencing assets in my rails app directly, for ex. background-image: url('/assets/bg.png')
.
But I just realized this wouldn't work in production since digested assets are served (/assets/bg-dddasd434r4tfdfs...sada.png) in production.
Is my only choice to use helper methods (for ex, image-url
) throughout the application or is there a more simpler solution to this?
Upvotes: 1
Views: 1405
Reputation: 133
This is an ancient question, but since I happened upon it with Google...
In Rails 5 there is the asset_path helper which even in the .scss files can return the proper path to a file.
Upvotes: 0
Reputation: 9843
In config/application.rb change the value of
config.assets.digest
to false
Upvotes: 1
Reputation: 44370
You can try asset_path('app.js', :digest => false)
or disable digest in the prodution env:
# config/environments/prodution.rb
config.assets.digest = false
Upvotes: 1