Skip to content

Instantly share code, notes, and snippets.

@yokolet
Created September 21, 2017 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yokolet/46639987f061c97e92764bfb0feabf55 to your computer and use it in GitHub Desktop.
Save yokolet/46639987f061c97e92764bfb0feabf55 to your computer and use it in GitHub Desktop.
app/controllers/concerns/exception_handler.rb
module ExceptionHandler
extend ActiveSupport::Concern
included do
rescue_from ActiveRecord::RecordNotFound do |e|
render json: { message: e.message }, status: :not_found
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment