My development setup gets its data from our production database, and
this production database refers to a bunch of images that aren't
available on my local machine, thus when running development I get a
large number of Rails RoutingErrors, which I don't really mind.
What I *do* mind is that catching every one of these errors takes
about 2-4 seconds, even with my quad-core desktop. If I try to load a
page with 5 missing images, it will probably be 20 seconds before I
can visit another page.
Has anyone else experienced this and thought up a clever workaround?
I had hoped that using
in my application controller would fix it, but it just serves to make
the exception not print out its text. It still takes the regular
amount of time per image for the exception to be caught and ignored.
Thank you greatly for any insights into how I might improve this.
Bill
Write a helper that wraps image_tag that checks to see whether you are
on your production box. Iff you are on the production box, then
image_tag it is, otherwise, some placeholder image guaranteed to be
local in your images dir.
Ah, definitely thinking along the right lines... then I'd just have to
figure out some way to determine if the file actually existed on the
machine or not. Which could probably be done, if not super
efficiently.
I'll keep this in mind as a potential solution, thanks for your idea.
If anyone else has any other ideas, I'd be open to those as well.