active_type 2.1.0 → 2.2.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 +4 -4
- data/.github/workflows/test.yml +0 -6
- data/CHANGELOG.md +8 -0
- data/Gemfile.4.2.mysql2.lock +1 -1
- data/Gemfile.4.2.pg.lock +1 -1
- data/Gemfile.4.2.sqlite3.lock +1 -1
- data/Gemfile.5.2.mysql2.lock +2 -2
- data/Gemfile.5.2.pg.lock +1 -1
- data/Gemfile.5.2.sqlite3.lock +2 -2
- data/Gemfile.6.0.sqlite3.lock +2 -2
- data/Gemfile.6.1.pg.lock +2 -2
- data/Gemfile.6.1.sqlite3.lock +2 -2
- data/Gemfile.7.0.pg +1 -1
- data/Gemfile.7.0.pg.lock +24 -26
- data/Gemfile.7.0.sqlite3 +1 -1
- data/Gemfile.7.0.sqlite3.lock +23 -25
- data/active_type.gemspec +1 -0
- data/lib/active_type/nested_attributes/association.rb +10 -6
- data/lib/active_type/no_table.rb +5 -1
- data/lib/active_type/version.rb +1 -1
- data/lib/active_type/virtual_attributes.rb +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bf7e0c548ca85d6d7cea9ffa097c10ec2c488d631e8c2919ba49b30a2f5849e1
|
|
4
|
+
data.tar.gz: fa88fa1d79a60dcc26b732157993f51b018b7e229b633aba605e1f03bf746ed2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d44944e817c52c3bb2cea812a4fd6ae59eb5222c9a692f194721a1caf64037092535952e5b1badbb1a78b488331876a0fb6e68fe1ba134e5231236c420b1fa06
|
|
7
|
+
data.tar.gz: b208069bad2606d6d9cac527350cf2df5b0ad25aa54c134e10cb038b3b6fe8bf6f4b4e89e9db12658c9fd308ddcfecea98ff64c1d8a62bb45c4ec05c23338b0d
|
data/.github/workflows/test.yml
CHANGED
|
@@ -28,8 +28,6 @@ jobs:
|
|
|
28
28
|
gemfile: Gemfile.6.0.sqlite3
|
|
29
29
|
- ruby: "2.6.3"
|
|
30
30
|
gemfile: Gemfile.6.1.sqlite3
|
|
31
|
-
- ruby: "2.6.3"
|
|
32
|
-
gemfile: Gemfile.7.0.sqlite3
|
|
33
31
|
- ruby: "2.7.4"
|
|
34
32
|
gemfile: Gemfile.5.2.sqlite3
|
|
35
33
|
- ruby: "2.7.4"
|
|
@@ -97,10 +95,6 @@ jobs:
|
|
|
97
95
|
uses: ruby/setup-ruby@v1
|
|
98
96
|
with:
|
|
99
97
|
ruby-version: ${{ matrix.ruby }}
|
|
100
|
-
- name: Install database client
|
|
101
|
-
run: |
|
|
102
|
-
sudo apt-get update
|
|
103
|
-
sudo apt-get install -y mariadb-client libmariadbclient-dev
|
|
104
98
|
- name: Bundle
|
|
105
99
|
run: |
|
|
106
100
|
gem install bundler:2.2.27
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## Unreleased changes
|
|
6
6
|
|
|
7
|
+
## 2.2.0 (2022-06-02)
|
|
8
|
+
|
|
9
|
+
* Fixed: ActiveType now actually works for Rails 7. Sorry for that. Thanks to @atcruice.
|
|
10
|
+
|
|
11
|
+
## 2.1.1 (2021-12-22)
|
|
12
|
+
|
|
13
|
+
* Fixed: Ruby compiler warning and suboptimal attribut name validation. Thanks to @remofrizsche.
|
|
14
|
+
|
|
7
15
|
## 2.1.0 (2021-12-22)
|
|
8
16
|
|
|
9
17
|
* Fixed: ActiveType now works for Rails 7.
|
data/Gemfile.4.2.mysql2.lock
CHANGED
data/Gemfile.4.2.pg.lock
CHANGED
data/Gemfile.4.2.sqlite3.lock
CHANGED
data/Gemfile.5.2.mysql2.lock
CHANGED
data/Gemfile.5.2.pg.lock
CHANGED
data/Gemfile.5.2.sqlite3.lock
CHANGED
data/Gemfile.6.0.sqlite3.lock
CHANGED
data/Gemfile.6.1.pg.lock
CHANGED
data/Gemfile.6.1.sqlite3.lock
CHANGED
data/Gemfile.7.0.pg
CHANGED
data/Gemfile.7.0.pg.lock
CHANGED
|
@@ -1,54 +1,52 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
active_type (2.0)
|
|
4
|
+
active_type (2.2.0)
|
|
5
5
|
activerecord (>= 3.2)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
activemodel (
|
|
11
|
-
activesupport (=
|
|
12
|
-
activerecord (
|
|
13
|
-
activemodel (=
|
|
14
|
-
activesupport (=
|
|
15
|
-
activesupport (
|
|
10
|
+
activemodel (7.0.3)
|
|
11
|
+
activesupport (= 7.0.3)
|
|
12
|
+
activerecord (7.0.3)
|
|
13
|
+
activemodel (= 7.0.3)
|
|
14
|
+
activesupport (= 7.0.3)
|
|
15
|
+
activesupport (7.0.3)
|
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
17
17
|
i18n (>= 1.6, < 2)
|
|
18
18
|
minitest (>= 5.1)
|
|
19
19
|
tzinfo (~> 2.0)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
i18n (1.8.11)
|
|
20
|
+
concurrent-ruby (1.1.10)
|
|
21
|
+
diff-lcs (1.5.0)
|
|
22
|
+
gemika (0.7.1)
|
|
23
|
+
i18n (1.10.0)
|
|
25
24
|
concurrent-ruby (~> 1.0)
|
|
26
25
|
minitest (5.15.0)
|
|
27
|
-
pg (1.
|
|
26
|
+
pg (1.3.5)
|
|
28
27
|
rake (13.0.6)
|
|
29
|
-
rspec (3.
|
|
30
|
-
rspec-core (~> 3.
|
|
31
|
-
rspec-expectations (~> 3.
|
|
32
|
-
rspec-mocks (~> 3.
|
|
33
|
-
rspec-core (3.
|
|
34
|
-
rspec-support (~> 3.
|
|
35
|
-
rspec-expectations (3.
|
|
28
|
+
rspec (3.11.0)
|
|
29
|
+
rspec-core (~> 3.11.0)
|
|
30
|
+
rspec-expectations (~> 3.11.0)
|
|
31
|
+
rspec-mocks (~> 3.11.0)
|
|
32
|
+
rspec-core (3.11.0)
|
|
33
|
+
rspec-support (~> 3.11.0)
|
|
34
|
+
rspec-expectations (3.11.0)
|
|
36
35
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
37
|
-
rspec-support (~> 3.
|
|
38
|
-
rspec-mocks (3.
|
|
36
|
+
rspec-support (~> 3.11.0)
|
|
37
|
+
rspec-mocks (3.11.1)
|
|
39
38
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
40
|
-
rspec-support (~> 3.
|
|
41
|
-
rspec-support (3.
|
|
39
|
+
rspec-support (~> 3.11.0)
|
|
40
|
+
rspec-support (3.11.0)
|
|
42
41
|
tzinfo (2.0.4)
|
|
43
42
|
concurrent-ruby (~> 1.0)
|
|
44
|
-
zeitwerk (2.5.1)
|
|
45
43
|
|
|
46
44
|
PLATFORMS
|
|
47
45
|
ruby
|
|
48
46
|
|
|
49
47
|
DEPENDENCIES
|
|
50
48
|
active_type!
|
|
51
|
-
activerecord (~>
|
|
49
|
+
activerecord (~> 7.0.3)
|
|
52
50
|
gemika
|
|
53
51
|
pg
|
|
54
52
|
rake
|
data/Gemfile.7.0.sqlite3
CHANGED
data/Gemfile.7.0.sqlite3.lock
CHANGED
|
@@ -1,54 +1,52 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
active_type (2.0)
|
|
4
|
+
active_type (2.2.0)
|
|
5
5
|
activerecord (>= 3.2)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
activemodel (
|
|
11
|
-
activesupport (=
|
|
12
|
-
activerecord (
|
|
13
|
-
activemodel (=
|
|
14
|
-
activesupport (=
|
|
15
|
-
activesupport (
|
|
10
|
+
activemodel (7.0.3)
|
|
11
|
+
activesupport (= 7.0.3)
|
|
12
|
+
activerecord (7.0.3)
|
|
13
|
+
activemodel (= 7.0.3)
|
|
14
|
+
activesupport (= 7.0.3)
|
|
15
|
+
activesupport (7.0.3)
|
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
17
17
|
i18n (>= 1.6, < 2)
|
|
18
18
|
minitest (>= 5.1)
|
|
19
19
|
tzinfo (~> 2.0)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
i18n (1.8.11)
|
|
20
|
+
concurrent-ruby (1.1.10)
|
|
21
|
+
diff-lcs (1.5.0)
|
|
22
|
+
gemika (0.7.1)
|
|
23
|
+
i18n (1.10.0)
|
|
25
24
|
concurrent-ruby (~> 1.0)
|
|
26
25
|
minitest (5.15.0)
|
|
27
26
|
rake (13.0.6)
|
|
28
|
-
rspec (3.
|
|
29
|
-
rspec-core (~> 3.
|
|
30
|
-
rspec-expectations (~> 3.
|
|
31
|
-
rspec-mocks (~> 3.
|
|
32
|
-
rspec-core (3.
|
|
33
|
-
rspec-support (~> 3.
|
|
34
|
-
rspec-expectations (3.
|
|
27
|
+
rspec (3.11.0)
|
|
28
|
+
rspec-core (~> 3.11.0)
|
|
29
|
+
rspec-expectations (~> 3.11.0)
|
|
30
|
+
rspec-mocks (~> 3.11.0)
|
|
31
|
+
rspec-core (3.11.0)
|
|
32
|
+
rspec-support (~> 3.11.0)
|
|
33
|
+
rspec-expectations (3.11.0)
|
|
35
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
36
|
-
rspec-support (~> 3.
|
|
37
|
-
rspec-mocks (3.
|
|
35
|
+
rspec-support (~> 3.11.0)
|
|
36
|
+
rspec-mocks (3.11.1)
|
|
38
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
39
|
-
rspec-support (~> 3.
|
|
40
|
-
rspec-support (3.
|
|
38
|
+
rspec-support (~> 3.11.0)
|
|
39
|
+
rspec-support (3.11.0)
|
|
41
40
|
sqlite3 (1.4.2)
|
|
42
41
|
tzinfo (2.0.4)
|
|
43
42
|
concurrent-ruby (~> 1.0)
|
|
44
|
-
zeitwerk (2.5.1)
|
|
45
43
|
|
|
46
44
|
PLATFORMS
|
|
47
45
|
ruby
|
|
48
46
|
|
|
49
47
|
DEPENDENCIES
|
|
50
48
|
active_type!
|
|
51
|
-
activerecord (~>
|
|
49
|
+
activerecord (~> 7.0.3)
|
|
52
50
|
gemika
|
|
53
51
|
rake
|
|
54
52
|
rspec (~> 3.4)
|
data/active_type.gemspec
CHANGED
|
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
|
|
|
10
10
|
s.summary = 'Make any Ruby object quack like ActiveRecord'
|
|
11
11
|
s.description = s.summary
|
|
12
12
|
s.license = 'MIT'
|
|
13
|
+
s.metadata = { 'rubygems_mfa_required' => 'true' }
|
|
13
14
|
|
|
14
15
|
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
15
16
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
@@ -16,11 +16,15 @@ module ActiveType
|
|
|
16
16
|
@allow_destroy = options.fetch(:allow_destroy, false)
|
|
17
17
|
@reject_if = options.delete(:reject_if)
|
|
18
18
|
@options = options.dup
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
|
|
20
|
+
@index_errors = case
|
|
21
|
+
when ActiveRecord::VERSION::MAJOR < 5
|
|
22
|
+
@options[:index_errors]
|
|
23
|
+
when ActiveRecord::VERSION::MAJOR < 7
|
|
24
|
+
@options[:index_errors] || ActiveRecord::Base.index_nested_attribute_errors
|
|
25
|
+
else
|
|
26
|
+
@options[:index_errors] || ActiveRecord.index_nested_attribute_errors
|
|
27
|
+
end
|
|
24
28
|
end
|
|
25
29
|
|
|
26
30
|
def assign_attributes(parent, attributes)
|
|
@@ -126,7 +130,7 @@ module ActiveType
|
|
|
126
130
|
end
|
|
127
131
|
|
|
128
132
|
def add_errors_to_parent(parent, child, index)
|
|
129
|
-
if ActiveRecord::VERSION::
|
|
133
|
+
if Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new("6.1")
|
|
130
134
|
child.errors.each do |error|
|
|
131
135
|
attribute = translate_error_attribute(error.attribute, index)
|
|
132
136
|
parent.errors.add(attribute, error.message)
|
data/lib/active_type/no_table.rb
CHANGED
|
@@ -101,7 +101,7 @@ module ActiveType
|
|
|
101
101
|
def columns_hash(table_name)
|
|
102
102
|
{}
|
|
103
103
|
end
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
def columns_hash?(table_name)
|
|
106
106
|
return false
|
|
107
107
|
end
|
|
@@ -144,6 +144,10 @@ module ActiveType
|
|
|
144
144
|
[]
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
+
def _query_by_sql(*)
|
|
148
|
+
[]
|
|
149
|
+
end
|
|
150
|
+
|
|
147
151
|
end
|
|
148
152
|
|
|
149
153
|
def destroy
|
data/lib/active_type/version.rb
CHANGED
|
@@ -112,7 +112,7 @@ module ActiveType
|
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
def validate_attribute_name!(name)
|
|
115
|
-
unless name.to_s =~ /\A[A-z0-9_]*\z/
|
|
115
|
+
unless name.to_s =~ /\A[A-Za-z0-9_]*\z/
|
|
116
116
|
raise InvalidAttributeNameError.new("'#{name}' is not a valid name for a virtual attribute")
|
|
117
117
|
end
|
|
118
118
|
end
|
|
@@ -273,7 +273,7 @@ module ActiveType
|
|
|
273
273
|
if value.is_a?(String) && value.length > 50
|
|
274
274
|
"#{value[0, 50]}...".inspect
|
|
275
275
|
elsif value.is_a?(Date) || value.is_a?(Time)
|
|
276
|
-
%("#{value.
|
|
276
|
+
%("#{value.to_formatted_s(:db)}")
|
|
277
277
|
elsif value.is_a?(Array) && value.size > 10
|
|
278
278
|
inspected = value.first(10).inspect
|
|
279
279
|
%(#{inspected[0...-1]}, ...])
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_type
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tobias Kraze
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2022-06-02 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -114,7 +114,8 @@ files:
|
|
|
114
114
|
homepage: https://github.com/makandra/active_type
|
|
115
115
|
licenses:
|
|
116
116
|
- MIT
|
|
117
|
-
metadata:
|
|
117
|
+
metadata:
|
|
118
|
+
rubygems_mfa_required: 'true'
|
|
118
119
|
post_install_message:
|
|
119
120
|
rdoc_options: []
|
|
120
121
|
require_paths:
|