Skip to content

Instantly share code, notes, and snippets.

@harssh
Forked from turadg/application.rb
Created November 15, 2013 03:58
Show Gist options
  • Save harssh/7478837 to your computer and use it in GitHub Desktop.
Save harssh/7478837 to your computer and use it in GitHub Desktop.
module MyApp
class Application < Rails::Application
require Rails.root + 'lib/custom_public_exceptions'
config.exceptions_app = CustomPublicExceptions.new Rails.public_path
end
end
class CustomPublicExceptions < ActionDispatch::PublicExceptions
def call(env)
status = env["PATH_INFO"][1..-1]
if "404" == status
# handle just 404 in our routes
MyApp::Application.routes.call env
else
super env
end
end
end
class ErrorsController < ApplicationController
skip_before_filter :authenticate_user! # if using Devise
def not_found
end
end
Geknowm::Application.routes.draw do
match "/404", :to => "errors#not_found"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment