Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Error pages that use layout

  • Loading branch information...
commit f55c1366e82fa35714f8392673b4b73aaded1a29 1 parent d75b677
@proglottis authored
View
15 app/controllers/errors_controller.rb
@@ -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
View
1  app/views/errors/internal_server_error.html.erb
@@ -0,0 +1 @@
+<h1>We're sorry, but something went wrong</h1>
View
2  app/views/errors/not_found.html.erb
@@ -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>
View
2  config/application.rb
@@ -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
2  config/routes.rb
@@ -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
26 public/404.html
@@ -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
25 public/500.html
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.