Image Tag without extension

I've got a Rails action that generates images from a DB, and it works just fine. The url is like property/pictures/234234?n=1. It spits out the image just fine.

However when I put this URL in an image_tag, it works but spits out lots of messages about no file extensions and then adds a .png to the end. Lucky, the .png doesn't break the action. Is there any way to force rails to allow no extension on an image URL?

Thanks,

Andrew

Looks to be your best bet, as there are no options on image_tag to ignore extensions.

Jason

If you have frozen Rails into vendor/rails, then just change the code:

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

       def image_path(source)          # unless (source.split("/").last || source).include?(".") || source.blank?          # ActiveSupport::Deprecation.warn(          # "You've called image_path with a source that doesn't include an extension. " +          # "In Rails 2.0, that will not result in .png automatically being appended. " +          # "So you should call image_path('#{source}.png') instead", caller          # )          # end

         compute_public_path(source, 'images')        end

If you don't want to do that, then you'll have to wait for Rails 2.0.

-Rob

Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com