Image_path without timestamp

Every time I use an asset tag helper, there is a parameter appended to
the end of my file name.

e.g.

From what I am reading, this appears to be a timestamp for caching
purposes. It works in most cases, but I want to use image_path to embed
a flash file.

.swf file in public/images/flash

e.g.

....

This outputs the proper path, but appends the timestamp and the flash
plugin will not display the file. Take the parameter off and it works
fine.

In production, the app will be deployed in a subdirectory, so the path
will be different.

Is there a different asset tag helper or approach I should be using?

Thanks,
Cory

.swf file in public/images/flash
fine.

In production, the app will be deployed in a subdirectory, so the path
will be different.

Is there a different asset tag helper or approach I should be using?

You could roll your own, or look at aliasing rewrite_asset_path to not
append the timestamp if the source matches “.swf”. Or modify
rails_asset_id(). I think you can also disable it completely, but I
forgot how at the moment.

In vendor/rails/actionpack/lib/action_view/helpers/asset_tag_helper.rb

     # Break out the asset path rewrite in case plugins wish to

put the asset id
# someplace other than the query string.
def rewrite_asset_path(source)
asset_id = rails_asset_id(source)
if asset_id.blank?
source
else
source + “?#{asset_id}”
end
end

Hi,

To disable asset_id completely, simply set the environment variable (for
instance in environment.rb):

ENV[‘RAILS_ASSET_ID’] = “”

cheers

Philip H. wrote:

.swf file in public/images/flash
fine.

In production, the app will be deployed in a subdirectory, so the path
will be different.

Is there a different asset tag helper or approach I should be using?

You could roll your own, or look at aliasing rewrite_asset_path to not
append the timestamp if the source matches “.swf”. Or modify
rails_asset_id(). I think you can also disable it completely, but I
forgot how at the moment.

In vendor/rails/actionpack/lib/action_view/helpers/asset_tag_helper.rb

     # Break out the asset path rewrite in case plugins wish to

put the asset id
# someplace other than the query string.
def rewrite_asset_path(source)
asset_id = rails_asset_id(source)
if asset_id.blank?
source
else
source + “?#{asset_id}”
end
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs