lib/table_sync/receiving/handler.rb in table_sync-6.3.0 vs lib/table_sync/receiving/handler.rb in table_sync-6.4.0

- old
+ new

@@ -21,11 +21,11 @@ target_keys = config.target_keys(data: data) validate_data(data, target_keys: target_keys) - data.sort_by! { |row| row.values_at(*target_keys).to_s } + data.sort_by! { |row| row.values_at(*target_keys).map { |value| sort_key(value) } } params = { data: data, target_keys: target_keys, version_key: version_key } if event == :update params[:default_values] = config.default_values(data: data) @@ -146,7 +146,11 @@ model.after_commit { config.after_commit_on_update(**params.merge(results: results)) } else model.after_commit { config.after_commit_on_destroy(**params.merge(results: results)) } end end + end + + def sort_key(value) + value.is_a?(Comparable) ? value : value.to_s end end