On Apr 16, 9:57 am, Yuval
<uberll...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Dear folks. I recently discovered that I get nasty RoutingError
> exceptions any time I refer to an image that doesn''t exist
(whether I
> use an html img tag or an image_tag helper). Now obviously, I
> shouldn''t be pointing to missing images, but it''s going
to happen on
> occasion. As far as I could tell from the helper documentation, Rails
> doesn''t confirm the existence of assets before linking to them, so
I
> didn''t expect such an ungracious bombing in the case of missing
> images. Are there underlying routes that handle the loading of images,
> that can perhaps be suppressed in the case of missing files? Does
> anyone have any input on this? Cheers.
You can modify your routes.rb so that if Apache can''t find the image,
routes it to rails, and of course the route isn''t in any controllers,
to return some "Image not Found" gif via a method in application.rb.
Especially if you have a consistent directory where you keep all those
images, you can make this route very specific, and still catch "real"
routing errors.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---