activerecord-rescue_from_duplicate icon indicating copy to clipboard operation
activerecord-rescue_from_duplicate copied to clipboard

Ruby gem to rescue from MySQL, PostgreSQL and Sqlite duplicate errors

Results 8 activerecord-rescue_from_duplicate issues
Sort by recently updated
recently updated
newest added
trafficstars

Not sure where the change in Rails is, but looking at the test suite, I suspect it just wasn't run in a while? tl;dr ```ruby # @raise ActiveRecord::RecordNotSaved def create_or_update(...)...

Hi 👋🏼 I read in the README that this gem will throw a RecordNotSaved exception on `create!`. I would like to understand why is that the case instead of returning...

The function that was being used to find indexes [explicitly ignores primary keys](https://github.com/rails/rails/blob/12613accfdd5665600958c2c291f8377bc1f11e3/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb#L14). The change in this PR will manually append the primary key to the list. This will let...

I am not 100% sure how to properly fix this test, but I opened this PR to start the discussion, happy to work on it with some guidance

As @matthewd pointed out, PG exceptions offer an API to get metadata about the exception, notably the concerned columns: http://www.rubydoc.info/gems/pg/PG/Result#error_field-instance_method It might be worth investigating.

enhancement

In Postgres, if you 1. have a transaction open 2. something which invokes non bang save/update on a rescued class 3. rescue a ActiveRecord::RecordNotUnique / PG::UniqueViolation 4. the transaction fails...

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...

Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.238.0 to 1.244.0. Release notes Sourced from ruby/setup-ruby's releases. v1.244.0 What's Changed Update/upgrade packages by @​MSP-Greg in ruby/setup-ruby#769 Full Changelog: https://github.com/ruby/setup-ruby/compare/v1.243.0...v1.244.0 v1.243.0 What's Changed Upgrade @​actions/cache to...

dependencies
github_actions