Move all 404 handling to application_controller

openid
Marcin Kulik 12 years ago
parent 46d0a94dda
commit 648cf1140b

@ -2,11 +2,11 @@ class NotFound < StandardError; end
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from(ActiveRecord::RecordNotFound) { render 'exceptions/not_found' }
class Unauthorized < Exception; end
class Forbidden < Exception; end
rescue_from ActiveRecord::RecordNotFound, :with => :not_found
rescue_from Unauthorized, :with => :unauthorized
rescue_from Forbidden, :with => :forbidden
@ -66,4 +66,16 @@ class ApplicationController < ActionController::Base
redirect_to login_path, :notice => "Please login"
end
end
def not_found
respond_to do |format|
format.any do
render :text => 'Requested resource not found', :status => 404
end
format.html do
render 'application/not_found', :status => 404
end
end
end
end

@ -1,15 +0,0 @@
class ExceptionsController < ApplicationController
def not_found
respond_to do |format|
format.any do
render :text => 'Requested resource not found', :status => 404
end
format.html do
render :status => 404
end
end
end
end

@ -1,5 +0,0 @@
require 'spec_helper'
describe ExceptionsController do
end
Loading…
Cancel
Save