Last active
January 23, 2020 11:36
-
-
Save roberson-miguel/09da30ca3bcf7ca29980703b718becbe to your computer and use it in GitHub Desktop.
Exemplo de uso do Rescue_From em Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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