4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/customs/rescue_traffic.rb', line 4
def self.included base
base.rescue_from CanCan::AccessDenied, with: proc{|e| rescue_exception_with e, :access_denied }
base.rescue_from ActionController::UnknownFormat, with: proc{|e| rescue_exception_with e, :not_acceptable } if defined? ActionController::UnknownFormat
base.rescue_from ActiveRecord::RecordNotFound, with: proc{|e| rescue_exception_with e, :not_found } if defined? ActiveRecord::RecordNotFound
base.rescue_from ActiveRecord::RecordInvalid , with: proc{|e| rescue_exception_with e, :unprocessable } if defined? ActiveRecord::RecordInvalid
base.rescue_from Mongoid::Errors::DocumentNotFound, with: proc{|e| rescue_exception_with e, :not_found } if defined? Mongoid::Errors
base.rescue_from Mongoid::Errors::Validations , with: proc{|e| rescue_exception_with e, :unprocessable } if defined? Mongoid::Errors
end
|