Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more context to RecordNotFound exception #881

Closed
wants to merge 1 commit into from

Conversation

dpuscher
Copy link

@dpuscher dpuscher commented Aug 28, 2018

ActiveRecord::RecordNotFound has the ability to add more context to the error using three additional parameters: model, primary_key and id.

Using them makes it more easy to analyze the exception and make the application behave in a smarter way (e.g. redirect to another page when objects are deleted from database)

This should fix bug #880.

Copy link

@sPaCeMoNk3yIam sPaCeMoNk3yIam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sPaCeMoNk3yIam
Copy link

Seems like, despite rails/rails@d763956 was written 3 years ago, it was only released with Rails v5.0.0.beta1. So that fix would mean not being compatible to Rails prior to v5.x.

@parndt
Copy link
Collaborator

parndt commented Nov 22, 2018

Thank you for the PR, I've since merged another PR which also addresses this issue #890

@parndt parndt closed this Nov 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants