Module: ExceptionHandlers
- Included in:
- Event::ApplicationController
- Defined in:
- app/controllers/concerns/exception_handlers.rb
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/concerns/exception_handlers.rb', line 4 def self.included(base) base.instance_eval do rescue_from ActiveRecord::RecordInvalid do |e| record = e.record class_name = record.model_name.singular errors = record.errors..map { |err| "#{class_name}.#{err}" } errors_response(errors) end rescue_from ActiveRecord::RecordNotFound do |_e| error_response("record.not_found", 404) end end end |