Dealing with empty 404 images


#1

so i’d like to do the following

map.connect ‘some/path’, :controller => ‘Foo’ if server.status == ‘404’

in other words:

if i get a 404 response, and a given path, i’d like to handle it by
returning my own content.

no- i don’t want a generic all-404 error page, i want to be able to
handle individual 404s. Where is this useful? For an address book
application where i don’t have photos of all the users, or similar.

anyone able to help?


#2

On Sunday 12 Mar 2006 22:58, James Cox wrote:

if i get a 404 response, and a given path, i’d like to handle it by
returning my own content.

I’m sure that’s possible, however…

no- i don’t want a generic all-404 error page, i want to be able to
handle individual 404s. Where is this useful? For an address book
application where i don’t have photos of all the users, or similar.

I had a similar thing, but solved it in my views instead, rather like:

<% unless @person.image.nil? || @person.image.empty? -%>
<%= image_tag @person.image %>
<% else -%>
<%= image_tag “no_pic” %>
<% end -%>

Cheers,

~Dave

Dave S.
Rent-A-Monkey Website Development
http://www.rentamonkey.com/

PGP Key: http://www.rentamonkey.com/pgpkey.asc


#3

Dave S. wrote:

<% unless @person.image.nil? || @person.image.empty? -%>
<%= image_tag @person.image %>
<% else -%>
<%= image_tag “no_pic” %>
<% end -%>

Alas I base mine on id’s of listing rather than a field - but thanks. I
hope i can hack rails or lighty into submission over this one.