Answer the question
In order to leave comments, you need to log in
How to correctly translate the ActiveRecord::RecordNotFound exception?
There is such an exception interceptor:
rescue_from ActiveRecord::RecordNotFound do |exception|
render json: {
error: exception.message
}, status: 404
end
rescue_from ActiveRecord::RecordNotFound do |exception|
render json: {
error: error: I18n.t('activerecord.exceptions.not_found', :class_name => self.class.name.demodulize, :id => params[:id])
}, status: 404
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question