Skip to content

Instantly share code, notes, and snippets.

@roberson-miguel
Last active January 23, 2020 11:36
Show Gist options
  • Save roberson-miguel/09da30ca3bcf7ca29980703b718becbe to your computer and use it in GitHub Desktop.
Save roberson-miguel/09da30ca3bcf7ca29980703b718becbe to your computer and use it in GitHub Desktop.
Exemplo de uso do Rescue_From em Rails
Criada as pastas /api e dentro dela a /v1
class Api::V1::ApiController < ActionController::API
rescue_from ActiveRecord::RecordNotFound, with: :not_found_errors
private
def not_found_errors
render json: 'Not Found', status: :not_found
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment