Permalink
Browse files

Error pages that use layout

  • Loading branch information...
1 parent d75b677 commit f55c1366e82fa35714f8392673b4b73aaded1a29 @proglottis committed Nov 18, 2012
@@ -0,0 +1,15 @@
+class ErrorsController < ApplicationController
+ def not_found
+ respond_to do |format|
+ format.html { render :status => 404 }
+ format.any { render :nothing => true, :status => 404 }
+ end
+ end
+
+ def internal_server_error
+ respond_to do |format|
+ format.html { render :status => 500 }
+ format.any { render :nothing => true, :status => 500 }
+ end
+ end
+end
@@ -0,0 +1 @@
+<h1>We're sorry, but something went wrong</h1>
@@ -0,0 +1,2 @@
+<h1>The page you were looking for doesn't exist</h1>
+<p>You may have mistyped the address or the page may have moved.</p>
@@ -60,5 +60,7 @@ class Application < Rails::Application
config.assets.version = '1.0'
config.action_mailer.default_url_options = { :host => 'ladder.nothing.co.nz' }
+
+ config.exceptions_app = self.routes
end
end
View
@@ -1,4 +1,6 @@
Ladder::Application.routes.draw do
+ match '/404', :to => 'errors#not_found'
+ match '/500', :to => 'errors#internal_server_error'
get 'auth/:service/callback' => 'sessions#callback'
post 'auth/:service/callback' => 'sessions#callback'
View
@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>The page you were looking for doesn't exist (404)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
- </style>
-</head>
-
-<body>
- <!-- This file lives in public/404.html -->
- <div class="dialog">
- <h1>The page you were looking for doesn't exist.</h1>
- <p>You may have mistyped the address or the page may have moved.</p>
- </div>
-</body>
-</html>
View
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>We're sorry, but something went wrong (500)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
- </style>
-</head>
-
-<body>
- <!-- This file lives in public/500.html -->
- <div class="dialog">
- <h1>We're sorry, but something went wrong.</h1>
- </div>
-</body>
-</html>

0 comments on commit f55c136

Please sign in to comment.