route to static resource?

Do you have something in your layout that says to find "favicon.ico" that could just be changed to "/favicon.ico" perhaps?

-Rob

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

Rob Biedenharn wrote:

Do you have something in your layout that says to find "favicon.ico"
that could just be changed to "/favicon.ico" perhaps?

Nope, it's nothing in my layout anywhere. It's Google Toolbar acting up
for some reason. Apparently others have seen it too:
http://www.google.com/support/forum/p/Toolbar/thread?tid=78479dcc02044f76&hl=en

But still wondering if I can 'route' to a static resource, occasionally
need that for other purposes too.

Rob Biedenharn wrote:

Do you have something in your layout that says to find "favicon.ico"
that could just be changed to "/favicon.ico" perhaps?

Nope, it's nothing in my layout anywhere. It's Google Toolbar acting up
for some reason. Apparently others have seen it too:
http://www.google.com/support/forum/p/Toolbar/thread?tid=78479dcc02044f76&hl=en

But still wondering if I can 'route' to a static resource, occasionally
need that for other purposes too.

You could add a catch-all route at the end that checks for "favicon.ico" and then send-file the real favicon.ico back. Or to speed it up do it using rack/metal.

But if were me, I'd do it in apache. That will definitely be the fastest.

You could add a catch-all route at the end that checks for
"favicon.ico" and then send-file the real favicon.ico back. Or to
speed it up do it using rack/metal.

But if were me, I'd do it in apache. That will definitely be the
fastest.

Woops, I forgot my real question. Right, I can do a catch-all like that
(I actually did figure out a way to do that) -- but how do I have a
rails route send back a static file?

You don't. Look at the 'send_data' method in action controller.

Do I need to create a method in application.rb for sending back the
static file? Any way to tell a route to result in a static file?

If you're going to do this in Rails and you're using a version that supports Rack, do it in rails metal. It will be a *lot* simpler and keep the entire thing out of your logs.

http://railscasts.com/episodes/150-rails-metal

-philip