active_type 1.8.0 → 1.10.1
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 +4 -12
- data/.ruby-version +1 -1
- data/CHANGELOG.md +21 -1
- data/Gemfile.4.2.mysql2.lock +2 -2
- data/Gemfile.4.2.pg.lock +2 -2
- data/Gemfile.4.2.sqlite3.lock +2 -2
- data/Gemfile.5.2.mysql2.lock +2 -2
- data/Gemfile.5.2.pg.lock +1 -1
- data/Gemfile.5.2.sqlite3.lock +1 -1
- data/Gemfile.6.0.sqlite3.lock +1 -1
- data/Gemfile.6.1.pg.lock +1 -1
- data/Gemfile.6.1.sqlite3.lock +1 -1
- data/README.md +2 -2
- data/lib/active_type/record_extension/inheritance.rb +5 -5
- data/lib/active_type/util.rb +2 -2
- data/lib/active_type/version.rb +1 -1
- metadata +2 -6
- data/Gemfile.3.2.mysql2 +0 -10
- data/Gemfile.3.2.mysql2.lock +0 -63
- data/Gemfile.3.2.sqlite3 +0 -10
- data/Gemfile.3.2.sqlite3.lock +0 -57
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69b64cf59cc14b34fae5a6ce26172b11e4877f763e5b2aef834004e66d697f8c
|
4
|
+
data.tar.gz: b446e1c689241ff6f4b96494a29e7b05347e6962322c3eda37c4cf01647a125e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9a257cb54508547e77592691c58193cf287866e32f51243a09b6300b58f78fe559ed8d6410d550906753cb850220178c23d35a5727850f23f7dad10f77e8b4f
|
7
|
+
data.tar.gz: ac3a81f9655a783fa15e928ee42c2d4a01ff04ff576f5709a7e862a99a2fdb2db1ca3107f50f1882ec57392f28cf23a25dfae57b0ecc3944d9da015edc7b4d3b
|
data/.github/workflows/test.yml
CHANGED
@@ -14,12 +14,8 @@ jobs:
|
|
14
14
|
fail-fast: false
|
15
15
|
matrix:
|
16
16
|
include:
|
17
|
-
- ruby: "2.
|
18
|
-
gemfile: Gemfile.3.2.sqlite3
|
19
|
-
- ruby: "2.3.8"
|
17
|
+
- ruby: "2.5.5"
|
20
18
|
gemfile: Gemfile.4.2.sqlite3
|
21
|
-
- ruby: "2.3.8"
|
22
|
-
gemfile: Gemfile.5.2.sqlite3
|
23
19
|
- ruby: "2.5.5"
|
24
20
|
gemfile: Gemfile.5.2.sqlite3
|
25
21
|
- ruby: "2.5.5"
|
@@ -80,12 +76,8 @@ jobs:
|
|
80
76
|
fail-fast: false
|
81
77
|
matrix:
|
82
78
|
include:
|
83
|
-
- ruby: "2.
|
84
|
-
gemfile: Gemfile.3.2.mysql2
|
85
|
-
- ruby: "2.3.8"
|
79
|
+
- ruby: "2.5.5"
|
86
80
|
gemfile: Gemfile.4.2.mysql2
|
87
|
-
- ruby: "2.3.8"
|
88
|
-
gemfile: Gemfile.5.2.mysql2
|
89
81
|
- ruby: "2.6.3"
|
90
82
|
gemfile: Gemfile.5.2.mysql2
|
91
83
|
- ruby: "2.7.2"
|
@@ -135,9 +127,9 @@ jobs:
|
|
135
127
|
fail-fast: false
|
136
128
|
matrix:
|
137
129
|
include:
|
138
|
-
- ruby: "2.
|
130
|
+
- ruby: "2.5.5"
|
139
131
|
gemfile: Gemfile.4.2.pg
|
140
|
-
- ruby: "2.
|
132
|
+
- ruby: "2.5.5"
|
141
133
|
gemfile: Gemfile.5.2.pg
|
142
134
|
- ruby: "2.5.5"
|
143
135
|
gemfile: Gemfile.6.1.pg
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
data/CHANGELOG.md
CHANGED
@@ -4,9 +4,29 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
## Unreleased changes
|
6
6
|
|
7
|
+
## 1.10.1 (2021-10-19)
|
8
|
+
|
9
|
+
* Removed: When casting an unsaved record, the new record will no longer have the same associations as the base record. This was introduced with version 1.8.0 and lead to issues (#147 and #148). Therefore the change was rolled back.
|
10
|
+
|
11
|
+
## 1.10.0 (2021-08-11)
|
12
|
+
|
13
|
+
* Removed: Tests for Ruby 2.4 and ActiveRecord 3.2.
|
14
|
+
|
15
|
+
## 1.9.1 (2021-06-29)
|
16
|
+
|
17
|
+
* Fixed: Retain `#mutations_from_database` when using ActiveType.cast (Rails 5.2+). Thanks to @unrooty-infinum.
|
18
|
+
|
19
|
+
## 1.9.0 (2021-05-20)
|
20
|
+
|
21
|
+
* Fixed: Extended records now use their own I18n namespace when looking up translations for models or attributes.
|
22
|
+
(introduced in [1.4.0](https://github.com/makandra/active_type/commit/b2aa4247ed1d45a4cd7e51e13d945cba7c38c597))
|
23
|
+
|
24
|
+
There was an issue ([#142](https://github.com/makandra/active_type/issues/142)) when extending an already extended records again. Now the I18n lookup will fall back
|
25
|
+
fall back correctly to the extended record's or even the base record's namespace.
|
26
|
+
|
7
27
|
## 1.8.0 (2021-04-27)
|
8
28
|
|
9
|
-
*
|
29
|
+
* Added: When casting an unsaved record, the new record will have the same associations as the base record.
|
10
30
|
|
11
31
|
## 1.7.0 (2021-04-27)
|
12
32
|
|
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/README.md
CHANGED
@@ -405,14 +405,14 @@ Now, if you load `credentials`, you will automatically receive records of type `
|
|
405
405
|
Supported Rails versions
|
406
406
|
------------------------
|
407
407
|
|
408
|
-
ActiveType is tested against ActiveRecord
|
408
|
+
ActiveType is tested against ActiveRecord 4.2, 5.1, 5.2, 6.0 and 6.1.
|
409
409
|
|
410
410
|
Later versions might work, earlier will not.
|
411
411
|
|
412
412
|
Supported Ruby versions
|
413
413
|
------------------------
|
414
414
|
|
415
|
-
ActiveType is tested against 2.
|
415
|
+
ActiveType is tested against 2.5, 2.6, 2.7 and 3.0.
|
416
416
|
|
417
417
|
|
418
418
|
Installation
|
@@ -34,13 +34,13 @@ module ActiveType
|
|
34
34
|
namespace = module_ancestors.detect do |n|
|
35
35
|
n.respond_to?(:use_relative_model_naming?) && n.use_relative_model_naming?
|
36
36
|
end
|
37
|
-
# We create a Name object, with the
|
37
|
+
# We create a Name object, with the sti class name, but self as the @klass reference
|
38
38
|
# This way lookup_ancestors is invoked on the right class instead of the extended_record_base_class
|
39
|
-
dup_model_name = ActiveModel::Name.new(self, namespace,
|
40
|
-
key = name.underscore
|
41
|
-
# We
|
39
|
+
dup_model_name = ActiveModel::Name.new(self, namespace, sti_name)
|
40
|
+
key = name.underscore.to_sym
|
41
|
+
# We set the `i18n_key` to lookup on the derived class key
|
42
42
|
# We keep the others the same to preserve parameter and route names
|
43
|
-
dup_model_name.
|
43
|
+
dup_model_name.instance_variable_set(:@i18n_key, key)
|
44
44
|
dup_model_name
|
45
45
|
else # name is nil for the anonymous intermediate class
|
46
46
|
extended_record_base_class.model_name
|
data/lib/active_type/util.rb
CHANGED
@@ -34,8 +34,8 @@ module ActiveType
|
|
34
34
|
casted.instance_variable_set(:@new_record, record.new_record?)
|
35
35
|
# Rails 3.2, 4.2
|
36
36
|
casted.instance_variable_set(:@destroyed, record.destroyed?)
|
37
|
-
|
38
|
-
casted.instance_variable_set(:@
|
37
|
+
# Rails 5.2+
|
38
|
+
casted.instance_variable_set(:@mutations_from_database, record.instance_variable_get(:@mutations_from_database))
|
39
39
|
|
40
40
|
# Rails 3.2, 4.2
|
41
41
|
errors = record.errors
|
data/lib/active_type/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.10.1
|
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: 2021-
|
12
|
+
date: 2021-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -65,10 +65,6 @@ files:
|
|
65
65
|
- ".ruby-version"
|
66
66
|
- CHANGELOG.md
|
67
67
|
- Gemfile
|
68
|
-
- Gemfile.3.2.mysql2
|
69
|
-
- Gemfile.3.2.mysql2.lock
|
70
|
-
- Gemfile.3.2.sqlite3
|
71
|
-
- Gemfile.3.2.sqlite3.lock
|
72
68
|
- Gemfile.4.2.mysql2
|
73
69
|
- Gemfile.4.2.mysql2.lock
|
74
70
|
- Gemfile.4.2.pg
|
data/Gemfile.3.2.mysql2
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem 'activerecord', '~> 3.2.22.5'
|
4
|
-
gem 'rspec', '~> 3.4'
|
5
|
-
gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.3.x-lts'
|
6
|
-
gem 'rake'
|
7
|
-
gem 'gemika'
|
8
|
-
|
9
|
-
gem 'active_type', :path => '.'
|
10
|
-
gem 'i18n', '=0.6.11' # 0.7 no longer builds for Ruby 1.8.7
|
data/Gemfile.3.2.mysql2.lock
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/makandra/mysql2
|
3
|
-
revision: c920d41e43c4722d4c065d2ea9d21494c560bd85
|
4
|
-
branch: 0.3.x-lts
|
5
|
-
specs:
|
6
|
-
mysql2 (0.3.21)
|
7
|
-
|
8
|
-
PATH
|
9
|
-
remote: .
|
10
|
-
specs:
|
11
|
-
active_type (1.6.0)
|
12
|
-
activerecord (>= 3.2)
|
13
|
-
|
14
|
-
GEM
|
15
|
-
remote: https://rubygems.org/
|
16
|
-
specs:
|
17
|
-
activemodel (3.2.22.5)
|
18
|
-
activesupport (= 3.2.22.5)
|
19
|
-
builder (~> 3.0.0)
|
20
|
-
activerecord (3.2.22.5)
|
21
|
-
activemodel (= 3.2.22.5)
|
22
|
-
activesupport (= 3.2.22.5)
|
23
|
-
arel (~> 3.0.2)
|
24
|
-
tzinfo (~> 0.3.29)
|
25
|
-
activesupport (3.2.22.5)
|
26
|
-
i18n (~> 0.6, >= 0.6.4)
|
27
|
-
multi_json (~> 1.0)
|
28
|
-
arel (3.0.3)
|
29
|
-
builder (3.0.4)
|
30
|
-
diff-lcs (1.2.5)
|
31
|
-
gemika (0.4.1)
|
32
|
-
i18n (0.6.11)
|
33
|
-
multi_json (1.13.1)
|
34
|
-
rake (10.4.2)
|
35
|
-
rspec (3.4.0)
|
36
|
-
rspec-core (~> 3.4.0)
|
37
|
-
rspec-expectations (~> 3.4.0)
|
38
|
-
rspec-mocks (~> 3.4.0)
|
39
|
-
rspec-core (3.4.1)
|
40
|
-
rspec-support (~> 3.4.0)
|
41
|
-
rspec-expectations (3.4.0)
|
42
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.4.0)
|
44
|
-
rspec-mocks (3.4.1)
|
45
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
-
rspec-support (~> 3.4.0)
|
47
|
-
rspec-support (3.4.1)
|
48
|
-
tzinfo (0.3.55)
|
49
|
-
|
50
|
-
PLATFORMS
|
51
|
-
ruby
|
52
|
-
|
53
|
-
DEPENDENCIES
|
54
|
-
active_type!
|
55
|
-
activerecord (~> 3.2.22.5)
|
56
|
-
gemika
|
57
|
-
i18n (= 0.6.11)
|
58
|
-
mysql2!
|
59
|
-
rake
|
60
|
-
rspec (~> 3.4)
|
61
|
-
|
62
|
-
BUNDLED WITH
|
63
|
-
2.1.4
|
data/Gemfile.3.2.sqlite3
DELETED
data/Gemfile.3.2.sqlite3.lock
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
active_type (1.6.0)
|
5
|
-
activerecord (>= 3.2)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
activemodel (3.2.22.5)
|
11
|
-
activesupport (= 3.2.22.5)
|
12
|
-
builder (~> 3.0.0)
|
13
|
-
activerecord (3.2.22.5)
|
14
|
-
activemodel (= 3.2.22.5)
|
15
|
-
activesupport (= 3.2.22.5)
|
16
|
-
arel (~> 3.0.2)
|
17
|
-
tzinfo (~> 0.3.29)
|
18
|
-
activesupport (3.2.22.5)
|
19
|
-
i18n (~> 0.6, >= 0.6.4)
|
20
|
-
multi_json (~> 1.0)
|
21
|
-
arel (3.0.3)
|
22
|
-
builder (3.0.4)
|
23
|
-
diff-lcs (1.2.5)
|
24
|
-
gemika (0.4.1)
|
25
|
-
i18n (0.6.11)
|
26
|
-
multi_json (1.13.1)
|
27
|
-
rake (10.4.2)
|
28
|
-
rspec (3.4.0)
|
29
|
-
rspec-core (~> 3.4.0)
|
30
|
-
rspec-expectations (~> 3.4.0)
|
31
|
-
rspec-mocks (~> 3.4.0)
|
32
|
-
rspec-core (3.4.1)
|
33
|
-
rspec-support (~> 3.4.0)
|
34
|
-
rspec-expectations (3.4.0)
|
35
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
-
rspec-support (~> 3.4.0)
|
37
|
-
rspec-mocks (3.4.1)
|
38
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
-
rspec-support (~> 3.4.0)
|
40
|
-
rspec-support (3.4.1)
|
41
|
-
sqlite3 (1.3.11)
|
42
|
-
tzinfo (0.3.55)
|
43
|
-
|
44
|
-
PLATFORMS
|
45
|
-
ruby
|
46
|
-
|
47
|
-
DEPENDENCIES
|
48
|
-
active_type!
|
49
|
-
activerecord (~> 3.2.22.5)
|
50
|
-
gemika
|
51
|
-
i18n (= 0.6.11)
|
52
|
-
rake
|
53
|
-
rspec (~> 3.4)
|
54
|
-
sqlite3
|
55
|
-
|
56
|
-
BUNDLED WITH
|
57
|
-
2.1.4
|