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

Rescuing from ActiveRecord::RecordInvalid in ResourcesController #3602

Conversation

softr8
Copy link
Contributor

@softr8 softr8 commented Apr 30, 2020

If for some reason, when creating/updating a record, it raises
record invalid exception, but resources controllers is not ready
to rescue from those exceptions, it just returns 422.

For example, when updating a product, if same taxon is added twice(for some reason) it returns a 422 page, because it raises record invalid exception from classifications, this change allows to handle that cases

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

If for some reason, when creating/updating a reocrd, it raises
record invalid exception, but resources controllers is not ready
to rescue from those exceptions, it just returns 422.
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

I like this, thanks @softr8!

@aldesantis aldesantis merged commit 3a2cee4 into solidusio:master May 6, 2020
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