active_record_upsert icon indicating copy to clipboard operation
active_record_upsert copied to clipboard

Upsert for Rails 5 / Active Record 5

Results 27 active_record_upsert issues
Sort by recently updated
recently updated
newest added

I'm running an upsert that replaces the current value (e.g. a non-nil value) with a nil, but the nil fails to get upserted. Upserts of any other value seems to...

It'd be really great to be able to support "ON CONFLICT DO NOTHING". Is there appetite for this feature?

When updating a record via `upsert!`, callbacks do not use the latest attribute values. See example below: ```ruby class Car < ActiveRecord::Base upsert_keys [:internal_id] before_save :calc_sum def calc_sum self.sum =...

Right now we trigger save, create and commit hooks. The create hooks might be ill-advised, since we don't know if there is an extant record.

This now decides that the test Step may fail on Rails main, which is not yet supported.

Ah, learning more about the next version of Rails here: the rails-main tests fail, and have warnings like > NoMethodError: > undefined method `rollback_active_record_state!' for # No action needed. Merging...

The test created in the testfile was failing before. I'm not sure if the fix is correct when it comes to the class method if it is on purpose that...