polymorphic_integer_type 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 549bf216afd3997c36413d2b6723e0cbc9256a7a6efa6fed0ce1befdb1400d10
4
- data.tar.gz: 80f07a091c228c80ba6f0a010a86c4a499a4aedeb96deab847a906a7b994d0f6
3
+ metadata.gz: 8d10470b4fde6a60c09165ec1d7359041515b9e63fcd4281739acf3620304dc8
4
+ data.tar.gz: 5ec3cf4e59dff1e62906eeb84357ca87a5f433503573d9806541ff115eeb5c26
5
5
  SHA512:
6
- metadata.gz: a012c19a75500b92faefd0b559a34a357de645570804ca604ab1e5964fbc2d7f09031395bbf679b825d02798face13870f4a0b1e8f752442ba517c945767e91b
7
- data.tar.gz: 3285ff0990650aec63cf0a3662b738969783e9cc868468a59272b675385ef396c0097c8996b237050c5ac17a604c6fa651b9c5a735a01c186b9d5a9ad63430bb
6
+ metadata.gz: 2c2239a63b258b65ff77aa190770d61369f938a2c281355a6c8ccede01271e8c57054257912c95210afeab910330d8aba42a31ad7d7de1c227e84281c2802528
7
+ data.tar.gz: 46963ce891ca6f9ad8148291dd9bd793361ce3e16c16ed939f2f08b00fa18f3f910253b799bd05262e5906252512514e4900457a2dca57f1fde08d795c48db54
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.5.0 (2026-04-30)
4
+
5
+ ### Added
6
+
7
+ - Add Rails 8.1 compatibility. Rails 8.1 changed `PredicateBuilder::PolymorphicArrayValue#initialize` from `(associated_table, values)` to `(reflection, values)`, dropping the `@associated_table` ivar. `type_to_ids_mapping` now reads `@reflection` when available and falls back to `@associated_table.send(:reflection)` for older Rails versions.
8
+
3
9
  ## v3.2.1 (2023-12-14)
4
10
 
5
11
  ### Fixed
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec path: ".."
6
+
7
+ gem "activerecord", github: "rails/rails", branch: "8-1-stable"
@@ -10,7 +10,15 @@ module PolymorphicIntegerType
10
10
  # end
11
11
 
12
12
  def type_to_ids_mapping
13
- association = @associated_table.send(:reflection)
13
+ # Rails 8.1 changed `PredicateBuilder::PolymorphicArrayValue#initialize`
14
+ # from `(associated_table, values)` to `(reflection, values)`, dropping
15
+ # the `@associated_table` ivar. Read whichever ivar is available so this
16
+ # gem works across Rails 6.1–8.1.
17
+ association = if instance_variable_defined?(:@reflection) && @reflection
18
+ @reflection
19
+ else
20
+ @associated_table.send(:reflection)
21
+ end
14
22
 
15
23
  name = association.name
16
24
  default_hash = Hash.new { |hsh, key| hsh[key] = [] }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PolymorphicIntegerType
4
- VERSION = '3.4.0'
4
+ VERSION = '3.5.0'
5
5
  end
@@ -136,6 +136,11 @@ describe PolymorphicIntegerType do
136
136
  expect(Link.where(source: [source])).to eq [link]
137
137
  end
138
138
 
139
+ it "properly finds objects when passing an array of mixed-type sources" do
140
+ link_for_dog = Link.create(source: dog)
141
+ expect(Link.where(source: [cat, dog])).to match_array [link, link_for_dog]
142
+ end
143
+
139
144
  it "properly finds the object with a find_by" do
140
145
  expect(Link.find_by(source: source, id: link.id)).to eql link
141
146
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polymorphic_integer_type
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle d'Oliveira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-25 00:00:00.000000000 Z
11
+ date: 2026-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -112,6 +112,7 @@ files:
112
112
  - gemfiles/Gemfile.rails-7.0-stable
113
113
  - gemfiles/Gemfile.rails-7.2-stable
114
114
  - gemfiles/Gemfile.rails-8.0-stable
115
+ - gemfiles/Gemfile.rails-8.1-stable
115
116
  - lib/polymorphic_integer_type.rb
116
117
  - lib/polymorphic_integer_type/activerecord_5_0_0/association_query_handler_extension.rb
117
118
  - lib/polymorphic_integer_type/activerecord_5_0_0/polymorphic_array_value_extension.rb