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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
<img src="<%= url_for_image_thingy %>" /> Looks to be your best bet, as there are no options on image_tag to ignore extensions. Jason On 10/31/07, Andrew Selder <aselder-ee4meeAH724@public.gmane.org> wrote:> > > 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 > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Oct 31, 2007, at 10:08 AM, Andrew Selder wrote:> > 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, > > AndrewIf 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-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---