404 handling

openid
Marcin Kulik 13 years ago
parent 139d6144de
commit 2abdf89511

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

@ -0,0 +1,3 @@
// Place all the styles related to the exceptions controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

@ -1,3 +1,7 @@
class NotFound < StandardError; end
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from(NotFound) { render 'exceptions/not_found' }
end

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

@ -0,0 +1,2 @@
module ExceptionsHelper
end

@ -55,4 +55,6 @@ AsciiIo::Application.routes.draw do
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
match "*a", :to => "exceptions#not_found"
end

@ -0,0 +1,5 @@
require 'spec_helper'
describe ExceptionsController do
end

@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the ExceptionsHelper. For example:
#
# describe ExceptionsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe ExceptionsHelper do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save