From 06f11232da40ecb7a622f19879ff2c1e78df53e0 Mon Sep 17 00:00:00 2001 From: jamal Date: Sat, 11 Oct 2014 19:39:14 -0400 Subject: [PATCH] Catch RecordNotFound exception --- app/assets/javascripts/app.js | 1 + app/controllers/application_controller.rb | 4 ++++ public/404.html | 2 ++ 3 files changed, 7 insertions(+) create mode 100644 app/assets/javascripts/app.js create mode 100644 public/404.html diff --git a/app/assets/javascripts/app.js b/app/assets/javascripts/app.js new file mode 100644 index 0000000..16373ed --- /dev/null +++ b/app/assets/javascripts/app.js @@ -0,0 +1 @@ +window.ENSL = Ember.Application.Create(); \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index eac98ce..e94de46 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -50,6 +50,10 @@ class ApplicationController < ActionController::Base render text: t(:application_stale) end + rescue_from ActiveRecord::RecordNotFound do |exception| + render :template => 'errors/404.html', :status => :not_found, :layout => 'errors' + end + private def update_user diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..b001ef3 --- /dev/null +++ b/public/404.html @@ -0,0 +1,2 @@ +

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.