Forum: Ruby on Rails Dealing with empty 404 images

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8365d053af5bcd5a2064a5e4d529f151?d=identicon&s=25 James Cox (Guest)
on 2006-03-12 23:58
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?
Cf7e5e4b5ca573eec214191fac420a2f?d=identicon&s=25 Dave Silvester (Guest)
on 2006-03-13 00:45
(Received via mailing list)
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 Silvester
Rent-A-Monkey Website Development
http://www.rentamonkey.com/

PGP Key: http://www.rentamonkey.com/pgpkey.asc
8365d053af5bcd5a2064a5e4d529f151?d=identicon&s=25 James Cox (Guest)
on 2006-03-13 00:50
Dave Silvester 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.
This topic is locked and can not be replied to.