File tree Expand file tree Collapse file tree 6 files changed +10
-10
lines changed
Expand file tree Collapse file tree 6 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 11# Changelog
22All notable changes to this project will be documented in this file.
33
4- ## [ 6.9.4 ] - 2025-11-21
4+ ## [ 6.10.0 ] - 2025-11-21
55### Fixed
66- Add on_first_sync callback
77
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ def perform(config:, targets:)
2222 next unless conditions? ( target )
2323
2424 model . transaction ( isolation : model . isolation_level ( :repeatable ) ) do
25- model . find_and_update ( row : target , target_keys :) do |entry |
25+ model . find_and_save ( row : target , target_keys :) do |entry |
2626 next unless allow? ( entry )
2727
2828 entry . hooks ||= [ ]
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ def after_commit(&)
129129 db . add_transaction_record ( AfterCommitWrap . new ( &) )
130130 end
131131
132- def find_and_update ( row :, target_keys :)
132+ def find_and_save ( row :, target_keys :)
133133 entry = raw_model . find_by! ( row . slice ( *target_keys ) )
134134 yield entry
135135 entry . save!
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ def after_commit(&)
7676 db . after_commit ( &)
7777 end
7878
79- def find_and_update ( row :, target_keys :)
79+ def find_and_save ( row :, target_keys :)
8080 entry = dataset . first! ( row . slice ( *target_keys ) )
8181 yield entry
8282 entry . save_changes
Original file line number Diff line number Diff line change 1111 it { expect { model . isolation_level ( :invalid ) } . to raise_error ( KeyError ) }
1212 end
1313
14- describe "find_and_update " do
14+ describe "find_and_save " do
1515 let ( :primary_key ) { :external_id }
1616 let ( :external_id ) { 100_500 }
1717 let! ( :player ) do
2626 let ( :row ) { { external_id : } }
2727
2828 it "finds and updates an entry" do
29- model . find_and_update ( row :, target_keys : [ primary_key ] ) do |entry |
29+ model . find_and_save ( row :, target_keys : [ primary_key ] ) do |entry |
3030 entry . online_status = true
3131 end
3232 expect ( player . reload . online_status ) . to be_truthy
3535 it "raise an error" do
3636 expect do
3737 row = { external_id : external_id + 1 }
38- model . find_and_update ( row :, target_keys : [ primary_key ] ) do |entry |
38+ model . find_and_save ( row :, target_keys : [ primary_key ] ) do |entry |
3939 entry . online_status = true
4040 end
4141 end . to raise_error ( ActiveRecord ::RecordNotFound )
Original file line number Diff line number Diff line change 1111 it { expect { model . isolation_level ( :invalid ) } . to raise_error ( KeyError ) }
1212 end
1313
14- describe "find_and_update " do
14+ describe "find_and_save " do
1515 let ( :primary_key ) { :external_id }
1616 let ( :external_id ) { 100_500 }
1717 let! ( :player ) do
2626 let ( :row ) { { external_id : } }
2727
2828 it "finds and updates an entry" do
29- model . find_and_update ( row :, target_keys : [ primary_key ] ) do |entry |
29+ model . find_and_save ( row :, target_keys : [ primary_key ] ) do |entry |
3030 entry . online_status = true
3131 end
3232 expect ( player . reload . online_status ) . to be_truthy
3535 it "raise an error" do
3636 expect do
3737 row = { external_id : external_id + 1 }
38- model . find_and_update ( row :, target_keys : [ primary_key ] ) do |entry |
38+ model . find_and_save ( row :, target_keys : [ primary_key ] ) do |entry |
3939 entry . online_status = true
4040 end
4141 end . to raise_error ( Sequel ::NoMatchingRow )
You can’t perform that action at this time.
0 commit comments