Skip to content

Commit

Permalink
Added record_not_found action to application.rb to automatically resp…
Browse files Browse the repository at this point in the history
…ond with a 404 when records cannot be found
  • Loading branch information
Jim Neath committed Oct 4, 2008
1 parent 0e4d2f7 commit 49d57ba
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/controllers/application.rb
Expand Up @@ -6,5 +6,13 @@ class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery :secret => 'b0a876313f3f9195e9bd01473bc5cd06'
filter_parameter_logging :password, :password_confirmation
rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found

protected

# Automatically respond with 404 for ActiveRecord::RecordNotFound
def record_not_found
render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404
end
end

0 comments on commit 49d57ba

Please sign in to comment.