Shopify / Shopify/activerecord-rescue_from_duplicate
RFC: ActiveRecord::InvalidForeignKey
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 90
- Forks
- 10
- Avg merge
- 31m
- Merged PRs (30d)
- 3
Description
Since the code would be in the same place, any interest in turning ActiveRecord::InvalidForeignKey errors into validation errors? Same risks apply, I think, as ActiveRecord::RecordNotUnique.
We use validations like these to handle when the application validation fails, e.g. we have a presence validation on the required belongs to, before the record is saved, the relation is deleted, so now the save raise an FK error, which we should probably turn into an active record error (and re-raise if inside of a transaction)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing ActiveRecord::RecordNotUnique handling and the corresponding ActiveRecord::InvalidForeignKey path. Review how validations behave when a relation is deleted before save, and how errors are re-raised inside transactions. Done means the project has an agreed implementation and tests for converting foreign-key failures into Active Record validation errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100