diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f28493..73fa38d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## 0.3.8 - 2024-? +## 0.3.8 - 2024-08-08 * Add `connect_with:` option to the collection definition. +* Adjust UpdateLazyAttribute callback to not use keyword arguments for better compatibility with older versions of Ruby. ## 0.3.7 - 2024-08-05 * Add `connected_to` to the collection for custom connection handling diff --git a/Gemfile.lock b/Gemfile.lock index 2260ebe..1718357 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - esse-active_record (0.3.7) + esse-active_record (0.3.8) activerecord (>= 4.2, < 8) esse (>= 0.3.0) diff --git a/ci/Gemfile.rails-5.2.lock b/ci/Gemfile.rails-5.2.lock index 0e4c8fa..33721ff 100644 --- a/ci/Gemfile.rails-5.2.lock +++ b/ci/Gemfile.rails-5.2.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - esse-active_record (0.3.7) + esse-active_record (0.3.8) activerecord (>= 4.2, < 8) esse (>= 0.3.0) diff --git a/ci/Gemfile.rails-6.0.lock b/ci/Gemfile.rails-6.0.lock index b0b12f1..30aece2 100644 --- a/ci/Gemfile.rails-6.0.lock +++ b/ci/Gemfile.rails-6.0.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - esse-active_record (0.3.7) + esse-active_record (0.3.8) activerecord (>= 4.2, < 8) esse (>= 0.3.0) diff --git a/ci/Gemfile.rails-6.1.lock b/ci/Gemfile.rails-6.1.lock index b295f2a..8b5e138 100644 --- a/ci/Gemfile.rails-6.1.lock +++ b/ci/Gemfile.rails-6.1.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - esse-active_record (0.3.7) + esse-active_record (0.3.8) activerecord (>= 4.2, < 8) esse (>= 0.3.0) diff --git a/ci/Gemfile.rails-7.0.lock b/ci/Gemfile.rails-7.0.lock index b0b12f1..30aece2 100644 --- a/ci/Gemfile.rails-7.0.lock +++ b/ci/Gemfile.rails-7.0.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - esse-active_record (0.3.7) + esse-active_record (0.3.8) activerecord (>= 4.2, < 8) esse (>= 0.3.0) diff --git a/ci/Gemfile.rails-7.1.lock b/ci/Gemfile.rails-7.1.lock index a876446..d6ba719 100644 --- a/ci/Gemfile.rails-7.1.lock +++ b/ci/Gemfile.rails-7.1.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - esse-active_record (0.3.7) + esse-active_record (0.3.8) activerecord (>= 4.2, < 8) esse (>= 0.3.0) diff --git a/lib/esse/active_record/callbacks/update_lazy_attribute.rb b/lib/esse/active_record/callbacks/update_lazy_attribute.rb index 76ec0d1..372cf5f 100644 --- a/lib/esse/active_record/callbacks/update_lazy_attribute.rb +++ b/lib/esse/active_record/callbacks/update_lazy_attribute.rb @@ -11,10 +11,10 @@ def initialize(attribute_name:, **kwargs, &block) end def call(model) - related_ids = Array(block_result || model.id) + related_ids = Esse::ArrayUtils.wrap(block_result || model.id) return true if related_ids.empty? - repo.update_documents_attribute(attribute_name, *related_ids, **options) + repo.update_documents_attribute(attribute_name, related_ids, options) true end diff --git a/lib/esse/active_record/version.rb b/lib/esse/active_record/version.rb index b398b29..4c9266a 100644 --- a/lib/esse/active_record/version.rb +++ b/lib/esse/active_record/version.rb @@ -2,6 +2,6 @@ module Esse module ActiveRecord - VERSION = '0.3.7' + VERSION = '0.3.8' end end diff --git a/spec/esse/active_record/callbacks/update_lazy_attribute_spec.rb b/spec/esse/active_record/callbacks/update_lazy_attribute_spec.rb index 5472ffc..4d9d5fa 100644 --- a/spec/esse/active_record/callbacks/update_lazy_attribute_spec.rb +++ b/spec/esse/active_record/callbacks/update_lazy_attribute_spec.rb @@ -53,7 +53,7 @@ it 'bulk update the state :total_counties attribute when the county is created' do state = create_record(State, name: 'Illinois') county = build_record(county_class, name: 'Cook', state: state) - expect(StatesIndex::State).to receive(:update_documents_attribute).with(:total_counties, state.id, **{}).and_call_original + expect(StatesIndex::State).to receive(:update_documents_attribute).with(:total_counties, [state.id], {}).and_call_original expect(StatesIndex).to esse_receive_request(:bulk).with( index: StatesIndex.index_name, body: [