polymorphic_integer_type 3.2.1 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/CHANGELOG.md +17 -2
- data/gemfiles/Gemfile.rails-6.1-stable +1 -0
- data/gemfiles/Gemfile.rails-7.0-stable +1 -0
- data/gemfiles/{Gemfile.rails-5.1-stable → Gemfile.rails-7.2-stable} +1 -1
- data/lib/polymorphic_integer_type/polymorphic_foreign_association_extension.rb +1 -1
- data/lib/polymorphic_integer_type/version.rb +1 -1
- data/polymorphic_integer_type.gemspec +1 -1
- data/spec/polymorphic_integer_type_spec.rb +10 -1
- data/spec/spec_helper.rb +7 -9
- 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 +17 -12
- data/gemfiles/Gemfile.rails-5.0-stable +0 -8
- data/gemfiles/Gemfile.rails-5.2-stable +0 -7
- data/gemfiles/Gemfile.rails-6.0-stable +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea9d51ebb89d80399f1ef17cc3e7163fe4923db10710d352e1f849cbeb81c782
|
4
|
+
data.tar.gz: '0910cded5f13a659aa01ba248353c6b2a23f81bb80dd447d54aa37f5a5a526b9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05e5887f356fd8d96352adc20ad4aae0d4dd8d8d42c7611b5bb83aabcdf03e7132e1366855ef4148b92e001afd9d10430525c43127ac34fe3b3dcc6e776cfbf8
|
7
|
+
data.tar.gz: 0da151ee5cd138ef7d677cdd5fb7040e674144cedfbcc06cff50dfb11c37a5b972717359e07a21ceac3c7aab03878a040002f2b4e41d309d5c90bf003def445f
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# Changelog
|
2
2
|
|
3
3
|
## v3.2.1 (2023-12-14)
|
4
4
|
|
@@ -10,4 +10,19 @@
|
|
10
10
|
|
11
11
|
- Added .idea/ folder to .gitignore
|
12
12
|
|
13
|
-
|
13
|
+
## v3.2.2 (2023-12-21)
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
- Fixed polymorphic_foreign_association_extension.rb to be compatible with other reflection than `has_many` and `has_one`.
|
18
|
+
|
19
|
+
## v3.3.0 (2024-10-29)
|
20
|
+
|
21
|
+
### Changed
|
22
|
+
|
23
|
+
- Upgrade rails support version to be compatible with 7.2
|
24
|
+
|
25
|
+
### Removed
|
26
|
+
|
27
|
+
- Remove unsupported rails versions(5.0, 5.2, 6.0) and ruby version(2.7)
|
28
|
+
|
@@ -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
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "activerecord", "<
|
21
|
+
spec.add_dependency "activerecord", "< 8"
|
22
22
|
spec.add_development_dependency "bundler"
|
23
23
|
spec.add_development_dependency "rake"
|
24
24
|
spec.add_development_dependency "rspec"
|
@@ -175,7 +175,7 @@ describe PolymorphicIntegerType do
|
|
175
175
|
before { link }
|
176
176
|
|
177
177
|
it "should have the proper source" do
|
178
|
-
expect(source.source_links[0].source).to eql source
|
178
|
+
expect(source.reload.source_links[0].source).to eql source
|
179
179
|
end
|
180
180
|
end
|
181
181
|
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
@@ -10,6 +10,8 @@ require 'support/dog'
|
|
10
10
|
require 'support/person'
|
11
11
|
require 'support/food'
|
12
12
|
require 'support/drink'
|
13
|
+
require 'support/profile'
|
14
|
+
require 'support/profile_history'
|
13
15
|
require 'support/namespaced_activity'
|
14
16
|
require 'byebug'
|
15
17
|
require 'pry'
|
@@ -21,18 +23,14 @@ RSpec.configure do |config|
|
|
21
23
|
active_record_version = Gem::Version.new(ActiveRecord::VERSION::STRING)
|
22
24
|
|
23
25
|
ActiveRecord::Base.establish_connection(database_config)
|
24
|
-
|
25
|
-
if active_record_version < Gem::Version.new("5.2")
|
26
|
-
ActiveRecord::Migrator.migrate(migrations_path)
|
27
|
-
end
|
28
|
-
|
29
|
-
if active_record_version >= Gem::Version.new("5.2") && active_record_version < Gem::Version.new("6.0")
|
30
|
-
ActiveRecord::MigrationContext.new(migrations_path).migrate
|
31
|
-
end
|
32
26
|
|
33
|
-
if active_record_version >= Gem::Version.new("6.0")
|
27
|
+
if active_record_version >= Gem::Version.new("6.1") && active_record_version < Gem::Version.new("7.0")
|
34
28
|
ActiveRecord::MigrationContext.new(migrations_path, ActiveRecord::SchemaMigration).migrate
|
35
29
|
end
|
30
|
+
|
31
|
+
if active_record_version >= Gem::Version.new("7.0")
|
32
|
+
ActiveRecord::MigrationContext.new(migrations_path).migrate
|
33
|
+
end
|
36
34
|
end
|
37
35
|
|
38
36
|
config.around do |example|
|
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.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle d'Oliveira
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "<"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "<"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,12 +109,9 @@ files:
|
|
109
109
|
- README.md
|
110
110
|
- Rakefile
|
111
111
|
- bin/setup
|
112
|
-
- gemfiles/Gemfile.rails-5.0-stable
|
113
|
-
- gemfiles/Gemfile.rails-5.1-stable
|
114
|
-
- gemfiles/Gemfile.rails-5.2-stable
|
115
|
-
- gemfiles/Gemfile.rails-6.0-stable
|
116
112
|
- gemfiles/Gemfile.rails-6.1-stable
|
117
113
|
- gemfiles/Gemfile.rails-7.0-stable
|
114
|
+
- gemfiles/Gemfile.rails-7.2-stable
|
118
115
|
- lib/polymorphic_integer_type.rb
|
119
116
|
- lib/polymorphic_integer_type/activerecord_5_0_0/association_query_handler_extension.rb
|
120
117
|
- lib/polymorphic_integer_type/activerecord_5_0_0/polymorphic_array_value_extension.rb
|
@@ -141,15 +138,19 @@ files:
|
|
141
138
|
- spec/support/migrations/5_create_drink_table.rb
|
142
139
|
- spec/support/migrations/6_create_plant_table.rb
|
143
140
|
- spec/support/migrations/7_create_activity_table.rb
|
141
|
+
- spec/support/migrations/8_create_profile_table.rb
|
142
|
+
- spec/support/migrations/9_create_profile_history_table.rb
|
144
143
|
- spec/support/namespaced_activity.rb
|
145
144
|
- spec/support/namespaced_animal.rb
|
146
145
|
- spec/support/namespaced_plant.rb
|
147
146
|
- spec/support/person.rb
|
147
|
+
- spec/support/profile.rb
|
148
|
+
- spec/support/profile_history.rb
|
148
149
|
homepage: ''
|
149
150
|
licenses:
|
150
151
|
- MIT
|
151
152
|
metadata: {}
|
152
|
-
post_install_message:
|
153
|
+
post_install_message:
|
153
154
|
rdoc_options: []
|
154
155
|
require_paths:
|
155
156
|
- lib
|
@@ -164,8 +165,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
165
|
- !ruby/object:Gem::Version
|
165
166
|
version: '0'
|
166
167
|
requirements: []
|
167
|
-
rubygems_version: 3.
|
168
|
-
signing_key:
|
168
|
+
rubygems_version: 3.3.27
|
169
|
+
signing_key:
|
169
170
|
specification_version: 4
|
170
171
|
summary: Use integers rather than strings for the _type field
|
171
172
|
test_files:
|
@@ -185,7 +186,11 @@ test_files:
|
|
185
186
|
- spec/support/migrations/5_create_drink_table.rb
|
186
187
|
- spec/support/migrations/6_create_plant_table.rb
|
187
188
|
- spec/support/migrations/7_create_activity_table.rb
|
189
|
+
- spec/support/migrations/8_create_profile_table.rb
|
190
|
+
- spec/support/migrations/9_create_profile_history_table.rb
|
188
191
|
- spec/support/namespaced_activity.rb
|
189
192
|
- spec/support/namespaced_animal.rb
|
190
193
|
- spec/support/namespaced_plant.rb
|
191
194
|
- spec/support/person.rb
|
195
|
+
- spec/support/profile.rb
|
196
|
+
- spec/support/profile_history.rb
|