RailsCasts Pro episodes are now free!

Learn more or hide this

Greg Reinacker's Profile

GitHub User: greinacker

Site: http://www.rassoc.com/gregr/weblog

Comments by Greg Reinacker

Avatar

Just to follow up...turns out that currently, the rails asset server is mounted regardless of the "fallback" setting, apparently to allow for cases just like this. There is some discussion about it at

https://github.com/rails/rails/pull/2886

It looks likely this behavior will change in the future, but not yet sure how.

Avatar

Just for more info...what I'm doing at the moment is just referencing /assets/application.css from my error pages. This works; however:

  1. It's unclear to me why it works; it seems rails has some sort of fallback if an asset isn't found in the public/assets directory. Which leads to...

  2. This file gets served from rails (I can see it happening in the production.log file), rather than "normal" assets that get served from the web server from the public/assets directory that's created during asset precompilation. So, for example, if rails is totally hosed and throwing exceptions, my 500.html isn't going to work.

Hmm.

Avatar

What are you planning to do for your 404.html and 500.html pages? I'm using the default asset pipeline settings (e.g. digests, don't allow fallback), and I use my application's CSS file inside those error pages.

The problem is, in production I don't know what the filename for that CSS file will be, since it's using a digest. And I want to keep my 500 page as just static HTML, without any processing on the server, so using the normal rails stylesheet link tags is out.

Any ideas? I hate to just copy the CSS I need...