active_type 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/README.md +4 -4
- data/gemfiles/Gemfile.3.2.mysql2 +1 -1
- data/gemfiles/Gemfile.3.2.mysql2.lock +16 -11
- data/gemfiles/Gemfile.3.2.sqlite3 +1 -1
- data/gemfiles/Gemfile.3.2.sqlite3.lock +16 -11
- data/gemfiles/Gemfile.4.0.sqlite3 +1 -1
- data/gemfiles/Gemfile.4.0.sqlite3.lock +16 -11
- data/gemfiles/Gemfile.4.1.sqlite3 +1 -1
- data/gemfiles/Gemfile.4.1.sqlite3.lock +16 -11
- data/gemfiles/Gemfile.4.2.1.mysql2 +1 -1
- data/gemfiles/Gemfile.4.2.1.mysql2.lock +16 -11
- data/gemfiles/Gemfile.4.2.1.pg +1 -1
- data/gemfiles/Gemfile.4.2.1.pg.lock +16 -11
- data/gemfiles/Gemfile.4.2.1.sqlite3 +1 -1
- data/gemfiles/Gemfile.4.2.1.sqlite3.lock +16 -11
- data/lib/active_type/version.rb +1 -1
- data/lib/active_type/virtual_attributes.rb +1 -1
- data/spec/active_type/extended_record/single_table_inheritance_spec.rb +6 -6
- data/spec/active_type/extended_record_spec.rb +32 -26
- data/spec/active_type/nested_attributes_spec.rb +51 -51
- data/spec/active_type/object_spec.rb +44 -33
- data/spec/active_type/record_spec.rb +15 -11
- data/spec/active_type/util_spec.rb +25 -25
- data/spec/integration/holidays_spec.rb +13 -13
- data/spec/integration/shape_spec.rb +12 -14
- data/spec/integration/sign_in_spec.rb +12 -12
- data/spec/integration/sign_up_spec.rb +9 -9
- data/spec/shared_examples/accessors.rb +3 -3
- data/spec/shared_examples/belongs_to.rb +2 -2
- data/spec/shared_examples/coercible_columns.rb +27 -27
- data/spec/shared_examples/constructor.rb +2 -2
- data/spec/shared_examples/defaults.rb +10 -10
- data/spec/shared_examples/dirty_tracking.rb +4 -4
- data/spec/shared_examples/dupable.rb +4 -4
- data/spec/shared_examples/mass_assignment.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: facbcaa21321fefe498b9dfd06e01373a76bc0c4
|
4
|
+
data.tar.gz: 1d49f4942cea269483f1e9f4c1054ef517267a8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37658e011161ce41985c72c649f62f6686f6465a7ead8e7546accfe7a38bc82fdde513701d3b2c7d3eb59ba63774d4597bad2f87b6c2b9e0b1bcd50606ac3c2e
|
7
|
+
data.tar.gz: 99064aa007b6b5b3f16063f884bee388e63ae2fdbed7b3b4afeae9aa5080ef01702edb2b63318ca402a195d3ea00d931d60a99abae56dc05c494167fab4b1643
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.4
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -207,10 +207,10 @@ end
|
|
207
207
|
- or as an array
|
208
208
|
|
209
209
|
```ruby
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
210
|
+
[
|
211
|
+
{ date: "new record's date" },
|
212
|
+
{ id: '3', date: "existing record's date" }
|
213
|
+
]
|
214
214
|
```
|
215
215
|
|
216
216
|
To use it with single records, use `nests_one`. It works like `accept_nested_attributes` does for `has_one`. Use `.record_attributes =` to build the child record.
|
data/gemfiles/Gemfile.3.2.mysql2
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
active_type (0.4.
|
4
|
+
active_type (0.4.5)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -24,14 +24,19 @@ GEM
|
|
24
24
|
i18n (0.6.11)
|
25
25
|
multi_json (1.11.2)
|
26
26
|
mysql2 (0.3.17)
|
27
|
-
rspec (
|
28
|
-
rspec-core (~>
|
29
|
-
rspec-expectations (~>
|
30
|
-
rspec-mocks (~>
|
31
|
-
rspec-core (
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
rspec (3.4.0)
|
28
|
+
rspec-core (~> 3.4.0)
|
29
|
+
rspec-expectations (~> 3.4.0)
|
30
|
+
rspec-mocks (~> 3.4.0)
|
31
|
+
rspec-core (3.4.1)
|
32
|
+
rspec-support (~> 3.4.0)
|
33
|
+
rspec-expectations (3.4.0)
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
+
rspec-support (~> 3.4.0)
|
36
|
+
rspec-mocks (3.4.1)
|
37
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
+
rspec-support (~> 3.4.0)
|
39
|
+
rspec-support (3.4.1)
|
35
40
|
tzinfo (0.3.46)
|
36
41
|
|
37
42
|
PLATFORMS
|
@@ -42,7 +47,7 @@ DEPENDENCIES
|
|
42
47
|
activerecord (= 3.2.22)
|
43
48
|
i18n (= 0.6.11)
|
44
49
|
mysql2 (= 0.3.17)
|
45
|
-
rspec (
|
50
|
+
rspec (~> 3.4)
|
46
51
|
|
47
52
|
BUNDLED WITH
|
48
|
-
1.
|
53
|
+
1.11.2
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
active_type (0.4.
|
4
|
+
active_type (0.4.5)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -23,14 +23,19 @@ GEM
|
|
23
23
|
diff-lcs (1.2.5)
|
24
24
|
i18n (0.6.11)
|
25
25
|
multi_json (1.11.2)
|
26
|
-
rspec (
|
27
|
-
rspec-core (~>
|
28
|
-
rspec-expectations (~>
|
29
|
-
rspec-mocks (~>
|
30
|
-
rspec-core (
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
rspec (3.4.0)
|
27
|
+
rspec-core (~> 3.4.0)
|
28
|
+
rspec-expectations (~> 3.4.0)
|
29
|
+
rspec-mocks (~> 3.4.0)
|
30
|
+
rspec-core (3.4.1)
|
31
|
+
rspec-support (~> 3.4.0)
|
32
|
+
rspec-expectations (3.4.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.4.0)
|
35
|
+
rspec-mocks (3.4.1)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.4.0)
|
38
|
+
rspec-support (3.4.1)
|
34
39
|
sqlite3 (1.3.11)
|
35
40
|
tzinfo (0.3.46)
|
36
41
|
|
@@ -41,8 +46,8 @@ DEPENDENCIES
|
|
41
46
|
active_type!
|
42
47
|
activerecord (= 3.2.22)
|
43
48
|
i18n (= 0.6.11)
|
44
|
-
rspec (
|
49
|
+
rspec (~> 3.4)
|
45
50
|
sqlite3
|
46
51
|
|
47
52
|
BUNDLED WITH
|
48
|
-
1.
|
53
|
+
1.11.2
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
active_type (0.4.
|
4
|
+
active_type (0.4.5)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -28,14 +28,19 @@ GEM
|
|
28
28
|
i18n (0.7.0)
|
29
29
|
minitest (4.7.5)
|
30
30
|
multi_json (1.11.2)
|
31
|
-
rspec (
|
32
|
-
rspec-core (~>
|
33
|
-
rspec-expectations (~>
|
34
|
-
rspec-mocks (~>
|
35
|
-
rspec-core (
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
rspec (3.4.0)
|
32
|
+
rspec-core (~> 3.4.0)
|
33
|
+
rspec-expectations (~> 3.4.0)
|
34
|
+
rspec-mocks (~> 3.4.0)
|
35
|
+
rspec-core (3.4.1)
|
36
|
+
rspec-support (~> 3.4.0)
|
37
|
+
rspec-expectations (3.4.0)
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
+
rspec-support (~> 3.4.0)
|
40
|
+
rspec-mocks (3.4.1)
|
41
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
+
rspec-support (~> 3.4.0)
|
43
|
+
rspec-support (3.4.1)
|
39
44
|
sqlite3 (1.3.11)
|
40
45
|
thread_safe (0.3.5)
|
41
46
|
tzinfo (0.3.46)
|
@@ -46,8 +51,8 @@ PLATFORMS
|
|
46
51
|
DEPENDENCIES
|
47
52
|
active_type!
|
48
53
|
activerecord (~> 4.0.0)
|
49
|
-
rspec (
|
54
|
+
rspec (~> 3.4)
|
50
55
|
sqlite3
|
51
56
|
|
52
57
|
BUNDLED WITH
|
53
|
-
1.
|
58
|
+
1.11.2
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
active_type (0.4.
|
4
|
+
active_type (0.4.5)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -26,14 +26,19 @@ GEM
|
|
26
26
|
i18n (0.7.0)
|
27
27
|
json (1.8.3)
|
28
28
|
minitest (5.8.3)
|
29
|
-
rspec (
|
30
|
-
rspec-core (~>
|
31
|
-
rspec-expectations (~>
|
32
|
-
rspec-mocks (~>
|
33
|
-
rspec-core (
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
rspec (3.4.0)
|
30
|
+
rspec-core (~> 3.4.0)
|
31
|
+
rspec-expectations (~> 3.4.0)
|
32
|
+
rspec-mocks (~> 3.4.0)
|
33
|
+
rspec-core (3.4.1)
|
34
|
+
rspec-support (~> 3.4.0)
|
35
|
+
rspec-expectations (3.4.0)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.4.0)
|
38
|
+
rspec-mocks (3.4.1)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.4.0)
|
41
|
+
rspec-support (3.4.1)
|
37
42
|
sqlite3 (1.3.11)
|
38
43
|
thread_safe (0.3.5)
|
39
44
|
tzinfo (1.2.2)
|
@@ -45,8 +50,8 @@ PLATFORMS
|
|
45
50
|
DEPENDENCIES
|
46
51
|
active_type!
|
47
52
|
activerecord (~> 4.1.0)
|
48
|
-
rspec (
|
53
|
+
rspec (~> 3.4)
|
49
54
|
sqlite3
|
50
55
|
|
51
56
|
BUNDLED WITH
|
52
|
-
1.
|
57
|
+
1.11.2
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
active_type (0.4.
|
4
|
+
active_type (0.4.5)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -27,14 +27,19 @@ GEM
|
|
27
27
|
json (1.8.3)
|
28
28
|
minitest (5.8.3)
|
29
29
|
mysql2 (0.3.20)
|
30
|
-
rspec (
|
31
|
-
rspec-core (~>
|
32
|
-
rspec-expectations (~>
|
33
|
-
rspec-mocks (~>
|
34
|
-
rspec-core (
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
rspec (3.4.0)
|
31
|
+
rspec-core (~> 3.4.0)
|
32
|
+
rspec-expectations (~> 3.4.0)
|
33
|
+
rspec-mocks (~> 3.4.0)
|
34
|
+
rspec-core (3.4.1)
|
35
|
+
rspec-support (~> 3.4.0)
|
36
|
+
rspec-expectations (3.4.0)
|
37
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
+
rspec-support (~> 3.4.0)
|
39
|
+
rspec-mocks (3.4.1)
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
+
rspec-support (~> 3.4.0)
|
42
|
+
rspec-support (3.4.1)
|
38
43
|
thread_safe (0.3.5)
|
39
44
|
tzinfo (1.2.2)
|
40
45
|
thread_safe (~> 0.1)
|
@@ -46,7 +51,7 @@ DEPENDENCIES
|
|
46
51
|
active_type!
|
47
52
|
activerecord (~> 4.2.1)
|
48
53
|
mysql2 (~> 0.3.17)
|
49
|
-
rspec (
|
54
|
+
rspec (~> 3.4)
|
50
55
|
|
51
56
|
BUNDLED WITH
|
52
|
-
1.
|
57
|
+
1.11.2
|
data/gemfiles/Gemfile.4.2.1.pg
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
active_type (0.4.
|
4
|
+
active_type (0.4.5)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -27,14 +27,19 @@ GEM
|
|
27
27
|
json (1.8.3)
|
28
28
|
minitest (5.8.3)
|
29
29
|
pg (0.18.4)
|
30
|
-
rspec (
|
31
|
-
rspec-core (~>
|
32
|
-
rspec-expectations (~>
|
33
|
-
rspec-mocks (~>
|
34
|
-
rspec-core (
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
rspec (3.4.0)
|
31
|
+
rspec-core (~> 3.4.0)
|
32
|
+
rspec-expectations (~> 3.4.0)
|
33
|
+
rspec-mocks (~> 3.4.0)
|
34
|
+
rspec-core (3.4.1)
|
35
|
+
rspec-support (~> 3.4.0)
|
36
|
+
rspec-expectations (3.4.0)
|
37
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
+
rspec-support (~> 3.4.0)
|
39
|
+
rspec-mocks (3.4.1)
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
+
rspec-support (~> 3.4.0)
|
42
|
+
rspec-support (3.4.1)
|
38
43
|
thread_safe (0.3.5)
|
39
44
|
tzinfo (1.2.2)
|
40
45
|
thread_safe (~> 0.1)
|
@@ -46,7 +51,7 @@ DEPENDENCIES
|
|
46
51
|
active_type!
|
47
52
|
activerecord (~> 4.2.1)
|
48
53
|
pg
|
49
|
-
rspec (
|
54
|
+
rspec (~> 3.4)
|
50
55
|
|
51
56
|
BUNDLED WITH
|
52
|
-
1.
|
57
|
+
1.11.2
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
active_type (0.4.
|
4
|
+
active_type (0.4.5)
|
5
5
|
activerecord (>= 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -26,14 +26,19 @@ GEM
|
|
26
26
|
i18n (0.7.0)
|
27
27
|
json (1.8.3)
|
28
28
|
minitest (5.8.3)
|
29
|
-
rspec (
|
30
|
-
rspec-core (~>
|
31
|
-
rspec-expectations (~>
|
32
|
-
rspec-mocks (~>
|
33
|
-
rspec-core (
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
rspec (3.4.0)
|
30
|
+
rspec-core (~> 3.4.0)
|
31
|
+
rspec-expectations (~> 3.4.0)
|
32
|
+
rspec-mocks (~> 3.4.0)
|
33
|
+
rspec-core (3.4.1)
|
34
|
+
rspec-support (~> 3.4.0)
|
35
|
+
rspec-expectations (3.4.0)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.4.0)
|
38
|
+
rspec-mocks (3.4.1)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.4.0)
|
41
|
+
rspec-support (3.4.1)
|
37
42
|
sqlite3 (1.3.11)
|
38
43
|
thread_safe (0.3.5)
|
39
44
|
tzinfo (1.2.2)
|
@@ -45,8 +50,8 @@ PLATFORMS
|
|
45
50
|
DEPENDENCIES
|
46
51
|
active_type!
|
47
52
|
activerecord (~> 4.2.1)
|
48
|
-
rspec (
|
53
|
+
rspec (~> 3.4)
|
49
54
|
sqlite3
|
50
55
|
|
51
56
|
BUNDLED WITH
|
52
|
-
1.
|
57
|
+
1.11.2
|
data/lib/active_type/version.rb
CHANGED
@@ -118,7 +118,7 @@ module ActiveType
|
|
118
118
|
|
119
119
|
def initialize_dup(other)
|
120
120
|
@virtual_attributes_cache = {}
|
121
|
-
@virtual_attributes = VirtualAttributes.deep_dup(
|
121
|
+
@virtual_attributes = VirtualAttributes.deep_dup(virtual_attributes)
|
122
122
|
|
123
123
|
super
|
124
124
|
end
|
@@ -24,11 +24,11 @@ describe 'ActiveType::Record[STIModel]' do
|
|
24
24
|
|
25
25
|
def should_save_and_load(save_as, load_as)
|
26
26
|
record = save_as.new(:persisted_string => "string")
|
27
|
-
record.save.
|
27
|
+
expect(record.save).to eq(true)
|
28
28
|
|
29
29
|
reloaded_child = load_as.find(record.id)
|
30
|
-
reloaded_child.persisted_string.
|
31
|
-
reloaded_child.
|
30
|
+
expect(reloaded_child.persisted_string).to eq("string")
|
31
|
+
expect(reloaded_child).to be_a(load_as)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'can save and load the active type record' do
|
@@ -46,11 +46,11 @@ describe 'ActiveType::Record[STIModel]' do
|
|
46
46
|
|
47
47
|
it 'can load via the base class and convert to active type record' do
|
48
48
|
record = STISpec::ExtendedChild.new(:persisted_string => "string")
|
49
|
-
record.save.
|
49
|
+
expect(record.save).to eq(true)
|
50
50
|
|
51
51
|
reloaded_child = STISpec::Child.find(record.id).becomes(STISpec::ExtendedChild)
|
52
|
-
reloaded_child.persisted_string.
|
53
|
-
reloaded_child.
|
52
|
+
expect(reloaded_child.persisted_string).to eq("string")
|
53
|
+
expect(reloaded_child).to be_a(STISpec::ExtendedChild)
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'can save classes further down the inheritance tree' do
|