Use this in your application.rb file :
rescue_from NameError, :with => :handle_exceptions
rescue_from NoMethodError, :with => :handle_exceptions
rescue_from ActiveRecord::Rollback, :with => :handle_exceptions
rescue_from ActiveRecord::StatementInvalid, :with => :handle_exceptions
rescue_from ActiveRecord::RecordNotFound, :with => :handle_exceptions
rescue_from ActionController::UnknownAction, :with => :handle_exceptions
rescue_from ActiveRecord::RecordNotFound, :with => :handle_exceptions
rescue_from ActiveRecord::StaleObjectError, :with => :handle_exceptions
rescue_from ActiveRecord::RecordInvalid, :with => :handle_exceptions
rescue_from ActiveRecord::RecordNotSaved, :with => :handle_exceptions
rescue_from ActionController::MethodNotAllowed, :with => :handle_exceptions
rescue_from ActionController::MethodNotAllowed, :with => :handle_exceptions
rescue_from ActionController::InvalidAuthenticityToken, :with => :handle_exceptions
private
def handle_exceptions
render :action => '500.html',:text => 'This is an error', :status => 500
end
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment