RailsCasts Pro episodes are now free!

Learn more or hide this

Thomas Baustert's Profile

GitHub User: thomasbaustert

Site: www.thomasbaustert.de

Comments by Thomas Baustert

Avatar

Thanks Ryan, exactly the right episode at the right time :)

One note on using curl. It seem easy and nice to simply generate the static pages via "curl http://localhost:3000/errors/404 > public/404.html".

But beware that you generate them under the development environment but serves them in production. At least when they are checked in and deployed to production.

Your pages may contain stuff that should only be visible in development mode and not on staging or production.

So you may need to run the curl command on production to get the correct pages. That can be done manually after each deployment but that's cumbersome.

One can add a capistrano recipes that runs after deploy:restart (when the app is up using the maybe new layout). But then you great the pages whenever you restart the app.

And with static pages you cannot serve different pages for different context. For example a signed in user will get a 404 page without his user menu (preferences, account, ...) and
maybe without the logout button. That can be ok in your case but should be considered.

If you are fine with static pages you may generate them outside the controller via a rake tasks and run that task on every deployment via after "deploy:create_symlink", "deploy:error_pages:create"

We tried this but now using your solution via the ErrorsController.

Thanks!