polymorphic_integer_type 3.2.1 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/polymorphic_integer_type/polymorphic_foreign_association_extension.rb +1 -1
- data/lib/polymorphic_integer_type/version.rb +1 -1
- data/spec/polymorphic_integer_type_spec.rb +9 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/migrations/8_create_profile_table.rb +16 -0
- data/spec/support/migrations/9_create_profile_history_table.rb +14 -0
- data/spec/support/person.rb +2 -0
- data/spec/support/profile.rb +4 -0
- data/spec/support/profile_history.rb +3 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfa2f9c68364a27168180b5dfeaae71b6ea2a9e74c313a8f42658b6e3a562dcd
|
4
|
+
data.tar.gz: b4f0b2225be4e6d8270f1e4d1755a15d791aec80a3f20afd3cd2c6d9f4923603
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12fa770fcb992eb05270b971a8f1ff88d881318d09bccc9f3e7d139e01396054873a68f1083238db0af4d7dc32bf3a715a51d848df2d9432e060580a6b524cf8
|
7
|
+
data.tar.gz: ca0d6e461f1543b2f47476d53e679d24de1420e60acaa8c51119f1bfa05ac962f5ac189912d9a7ae12e63f9568af91e6e0550dbc448efc3b2e75c6f655a8e0c5
|
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,7 @@ module PolymorphicIntegerType
|
|
3
3
|
|
4
4
|
def set_owner_attributes(record)
|
5
5
|
super
|
6
|
-
if reflection.foreign_integer_type && reflection.integer_type
|
6
|
+
if reflection.try(:foreign_integer_type) && reflection.try(:integer_type)
|
7
7
|
record._write_attribute(reflection.foreign_integer_type, reflection.integer_type)
|
8
8
|
end
|
9
9
|
end
|
@@ -371,4 +371,13 @@ describe PolymorphicIntegerType do
|
|
371
371
|
expect(link.normal_target_type).to eq("InlineDrink2")
|
372
372
|
end
|
373
373
|
end
|
374
|
+
|
375
|
+
context "when using other reflection" do
|
376
|
+
it "owner able to association ActiveRecord::Reflection::ThroughReflection successfully" do
|
377
|
+
profile_history = ProfileHistory.new
|
378
|
+
owner.profile_histories << profile_history
|
379
|
+
|
380
|
+
expect(owner.profile_histories).to eq([profile_history])
|
381
|
+
end
|
382
|
+
end
|
374
383
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/person.rb
CHANGED
@@ -5,4 +5,6 @@ class Person < ActiveRecord::Base
|
|
5
5
|
has_many :source_links, as: :source, integer_type: true, class_name: "Link"
|
6
6
|
|
7
7
|
has_many :pet_source_links, class_name: "Link", through: :pets, source: :source_links
|
8
|
+
has_many :profiles
|
9
|
+
has_many :profile_histories, class_name: "ProfileHistory", through: :profiles
|
8
10
|
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.2.
|
4
|
+
version: 3.2.2
|
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: 2023-12-
|
11
|
+
date: 2023-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -141,10 +141,14 @@ files:
|
|
141
141
|
- spec/support/migrations/5_create_drink_table.rb
|
142
142
|
- spec/support/migrations/6_create_plant_table.rb
|
143
143
|
- spec/support/migrations/7_create_activity_table.rb
|
144
|
+
- spec/support/migrations/8_create_profile_table.rb
|
145
|
+
- spec/support/migrations/9_create_profile_history_table.rb
|
144
146
|
- spec/support/namespaced_activity.rb
|
145
147
|
- spec/support/namespaced_animal.rb
|
146
148
|
- spec/support/namespaced_plant.rb
|
147
149
|
- spec/support/person.rb
|
150
|
+
- spec/support/profile.rb
|
151
|
+
- spec/support/profile_history.rb
|
148
152
|
homepage: ''
|
149
153
|
licenses:
|
150
154
|
- MIT
|
@@ -185,7 +189,11 @@ test_files:
|
|
185
189
|
- spec/support/migrations/5_create_drink_table.rb
|
186
190
|
- spec/support/migrations/6_create_plant_table.rb
|
187
191
|
- spec/support/migrations/7_create_activity_table.rb
|
192
|
+
- spec/support/migrations/8_create_profile_table.rb
|
193
|
+
- spec/support/migrations/9_create_profile_history_table.rb
|
188
194
|
- spec/support/namespaced_activity.rb
|
189
195
|
- spec/support/namespaced_animal.rb
|
190
196
|
- spec/support/namespaced_plant.rb
|
191
197
|
- spec/support/person.rb
|
198
|
+
- spec/support/profile.rb
|
199
|
+
- spec/support/profile_history.rb
|