active_type 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -4
- data/CHANGELOG.md +8 -0
- data/README.md +2 -2
- data/gemfiles/Gemfile.3.2.mysql2.lock +1 -1
- data/gemfiles/Gemfile.3.2.sqlite3.lock +1 -1
- data/gemfiles/Gemfile.4.0.sqlite3.lock +1 -1
- data/gemfiles/Gemfile.4.1.sqlite3.lock +1 -1
- data/gemfiles/Gemfile.4.2.1.mysql2.lock +1 -1
- data/gemfiles/Gemfile.4.2.1.pg.lock +1 -1
- data/gemfiles/Gemfile.4.2.1.sqlite3.lock +1 -1
- data/gemfiles/Gemfile.5.0.0.mysql2.lock +1 -1
- data/gemfiles/Gemfile.5.0.0.pg.lock +1 -1
- data/gemfiles/Gemfile.5.0.0.sqlite3.lock +1 -1
- data/gemfiles/{Gemfile.5.0.0.mysql2 → Gemfile.5.1.0.mysql2} +2 -2
- data/gemfiles/Gemfile.5.1.0.mysql2.lock +56 -0
- data/gemfiles/{Gemfile.5.0.0.pg → Gemfile.5.1.0.pg} +1 -1
- data/gemfiles/Gemfile.5.1.0.pg.lock +56 -0
- data/gemfiles/Gemfile.5.1.0.sqlite3 +8 -0
- data/gemfiles/Gemfile.5.1.0.sqlite3.lock +56 -0
- data/lib/active_type/nested_attributes/association.rb +1 -1
- data/lib/active_type/type_caster.rb +6 -17
- data/lib/active_type/version.rb +1 -1
- data/lib/active_type/virtual_attributes.rb +1 -1
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc819ae9aa3ea32e2f3b9941e64ed7a6e7e74024
|
4
|
+
data.tar.gz: 7220d7bd91fdaa551cccb124daabe3ac623b5e93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f17d366fc2aeffa030b6950920bce04ee91229ba7531b48555a5d96a29fc4882fe3f696b99906cc1fc08f08d42a18de0e2860bc9268c6513c08414fd95b7698e
|
7
|
+
data.tar.gz: b0aa279cbff3af11b254a39006767f8b16a0c295b3f1bdf635e2df6c84697289bc2154869f308fba5e59c8d23a68917f7e4e37ed47746bbe0adfbc9f0839dde4
|
data/.travis.yml
CHANGED
@@ -11,9 +11,10 @@ gemfile:
|
|
11
11
|
- gemfiles/Gemfile.4.2.1.mysql2
|
12
12
|
- gemfiles/Gemfile.4.2.1.pg
|
13
13
|
- gemfiles/Gemfile.4.2.1.sqlite3
|
14
|
-
- gemfiles/Gemfile.5.0.0.mysql2
|
15
|
-
- gemfiles/Gemfile.5.0.0.pg
|
16
14
|
- gemfiles/Gemfile.5.0.0.sqlite3
|
15
|
+
- gemfiles/Gemfile.5.1.0.mysql2
|
16
|
+
- gemfiles/Gemfile.5.1.0.pg
|
17
|
+
- gemfiles/Gemfile.5.1.0.sqlite3
|
17
18
|
before_script:
|
18
19
|
- psql -c 'create database active_type_test;' -U postgres
|
19
20
|
- mysql -e 'create database IF NOT EXISTS active_type_test;'
|
@@ -41,9 +42,11 @@ matrix:
|
|
41
42
|
- rvm: "2.1.7"
|
42
43
|
gemfile: gemfiles/Gemfile.5.0.0.sqlite3
|
43
44
|
- rvm: "2.1.7"
|
44
|
-
gemfile: gemfiles/Gemfile.5.
|
45
|
+
gemfile: gemfiles/Gemfile.5.1.0.sqlite3
|
45
46
|
- rvm: "2.1.7"
|
46
|
-
gemfile: gemfiles/Gemfile.5.
|
47
|
+
gemfile: gemfiles/Gemfile.5.1.0.mysql2
|
48
|
+
- rvm: "2.1.7"
|
49
|
+
gemfile: gemfiles/Gemfile.5.1.0.pg
|
47
50
|
- rvm: "2.2.4"
|
48
51
|
gemfile: gemfiles/Gemfile.4.0.sqlite3
|
49
52
|
- rvm: "2.2.4"
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
ActiveType is in a pre-1.0 state. This means that its APIs and behavior are subject to breaking changes without deprecation notices. Until 1.0, version numbers will follow a [Semver][]-ish `0.y.z` format, where `y` is incremented when new features or breaking changes are introduced, and `z` is incremented for lesser changes or bug fixes.
|
6
6
|
|
7
|
+
## [0.7.1][] (2017-06-19)
|
8
|
+
|
9
|
+
* ActiveType::Object no longer requires a database connection on Rails 5+ (it never did on Rails 3 or 4).
|
10
|
+
|
11
|
+
## [0.7.0][] (2017-04-21)
|
12
|
+
|
13
|
+
* Support `index_errors: true` for `nest_many`.
|
14
|
+
|
7
15
|
## [0.6.4][] (2017-02-27)
|
8
16
|
|
9
17
|
* Fix an issue when using `ActiveType.cast` "too early".
|
data/README.md
CHANGED
@@ -352,14 +352,14 @@ sign_up.is_a?(SignUp) # => true
|
|
352
352
|
Supported Rails versions
|
353
353
|
------------------------
|
354
354
|
|
355
|
-
ActiveType is tested against ActiveRecord 3.2, 4.0, 4.1, 4.2 and 5.
|
355
|
+
ActiveType is tested against ActiveRecord 3.2, 4.0, 4.1, 4.2, 5.0, and 5.1.
|
356
356
|
|
357
357
|
Later versions might work, earlier will not.
|
358
358
|
|
359
359
|
Supported Ruby versions
|
360
360
|
------------------------
|
361
361
|
|
362
|
-
ActiveType is tested against
|
362
|
+
ActiveType is tested against 2.1.7 (for 3.2, 4.x only), 2.2.4 and 2.3.1.
|
363
363
|
|
364
364
|
|
365
365
|
Installation
|
@@ -0,0 +1,56 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
active_type (0.7.1)
|
5
|
+
activerecord (>= 3.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (5.1.1)
|
11
|
+
activesupport (= 5.1.1)
|
12
|
+
activerecord (5.1.1)
|
13
|
+
activemodel (= 5.1.1)
|
14
|
+
activesupport (= 5.1.1)
|
15
|
+
arel (~> 8.0)
|
16
|
+
activesupport (5.1.1)
|
17
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
+
i18n (~> 0.7)
|
19
|
+
minitest (~> 5.1)
|
20
|
+
tzinfo (~> 1.1)
|
21
|
+
arel (8.0.0)
|
22
|
+
concurrent-ruby (1.0.5)
|
23
|
+
diff-lcs (1.3)
|
24
|
+
i18n (0.8.4)
|
25
|
+
minitest (5.10.2)
|
26
|
+
mysql2 (0.4.6)
|
27
|
+
rake (12.0.0)
|
28
|
+
rspec (3.6.0)
|
29
|
+
rspec-core (~> 3.6.0)
|
30
|
+
rspec-expectations (~> 3.6.0)
|
31
|
+
rspec-mocks (~> 3.6.0)
|
32
|
+
rspec-core (3.6.0)
|
33
|
+
rspec-support (~> 3.6.0)
|
34
|
+
rspec-expectations (3.6.0)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.6.0)
|
37
|
+
rspec-mocks (3.6.0)
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
+
rspec-support (~> 3.6.0)
|
40
|
+
rspec-support (3.6.0)
|
41
|
+
thread_safe (0.3.6)
|
42
|
+
tzinfo (1.2.3)
|
43
|
+
thread_safe (~> 0.1)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
active_type!
|
50
|
+
activerecord (~> 5.1.0)
|
51
|
+
mysql2
|
52
|
+
rake
|
53
|
+
rspec (~> 3.4)
|
54
|
+
|
55
|
+
BUNDLED WITH
|
56
|
+
1.12.1
|
@@ -0,0 +1,56 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
active_type (0.7.1)
|
5
|
+
activerecord (>= 3.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (5.1.1)
|
11
|
+
activesupport (= 5.1.1)
|
12
|
+
activerecord (5.1.1)
|
13
|
+
activemodel (= 5.1.1)
|
14
|
+
activesupport (= 5.1.1)
|
15
|
+
arel (~> 8.0)
|
16
|
+
activesupport (5.1.1)
|
17
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
+
i18n (~> 0.7)
|
19
|
+
minitest (~> 5.1)
|
20
|
+
tzinfo (~> 1.1)
|
21
|
+
arel (8.0.0)
|
22
|
+
concurrent-ruby (1.0.5)
|
23
|
+
diff-lcs (1.3)
|
24
|
+
i18n (0.8.4)
|
25
|
+
minitest (5.10.2)
|
26
|
+
pg (0.21.0)
|
27
|
+
rake (12.0.0)
|
28
|
+
rspec (3.6.0)
|
29
|
+
rspec-core (~> 3.6.0)
|
30
|
+
rspec-expectations (~> 3.6.0)
|
31
|
+
rspec-mocks (~> 3.6.0)
|
32
|
+
rspec-core (3.6.0)
|
33
|
+
rspec-support (~> 3.6.0)
|
34
|
+
rspec-expectations (3.6.0)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.6.0)
|
37
|
+
rspec-mocks (3.6.0)
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
+
rspec-support (~> 3.6.0)
|
40
|
+
rspec-support (3.6.0)
|
41
|
+
thread_safe (0.3.6)
|
42
|
+
tzinfo (1.2.3)
|
43
|
+
thread_safe (~> 0.1)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
active_type!
|
50
|
+
activerecord (~> 5.1.0)
|
51
|
+
pg
|
52
|
+
rake
|
53
|
+
rspec (~> 3.4)
|
54
|
+
|
55
|
+
BUNDLED WITH
|
56
|
+
1.12.1
|
@@ -0,0 +1,56 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
active_type (0.7.1)
|
5
|
+
activerecord (>= 3.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (5.1.1)
|
11
|
+
activesupport (= 5.1.1)
|
12
|
+
activerecord (5.1.1)
|
13
|
+
activemodel (= 5.1.1)
|
14
|
+
activesupport (= 5.1.1)
|
15
|
+
arel (~> 8.0)
|
16
|
+
activesupport (5.1.1)
|
17
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
+
i18n (~> 0.7)
|
19
|
+
minitest (~> 5.1)
|
20
|
+
tzinfo (~> 1.1)
|
21
|
+
arel (8.0.0)
|
22
|
+
concurrent-ruby (1.0.5)
|
23
|
+
diff-lcs (1.3)
|
24
|
+
i18n (0.8.4)
|
25
|
+
minitest (5.10.2)
|
26
|
+
rake (12.0.0)
|
27
|
+
rspec (3.6.0)
|
28
|
+
rspec-core (~> 3.6.0)
|
29
|
+
rspec-expectations (~> 3.6.0)
|
30
|
+
rspec-mocks (~> 3.6.0)
|
31
|
+
rspec-core (3.6.0)
|
32
|
+
rspec-support (~> 3.6.0)
|
33
|
+
rspec-expectations (3.6.0)
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
+
rspec-support (~> 3.6.0)
|
36
|
+
rspec-mocks (3.6.0)
|
37
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
+
rspec-support (~> 3.6.0)
|
39
|
+
rspec-support (3.6.0)
|
40
|
+
sqlite3 (1.3.13)
|
41
|
+
thread_safe (0.3.6)
|
42
|
+
tzinfo (1.2.3)
|
43
|
+
thread_safe (~> 0.1)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
active_type!
|
50
|
+
activerecord (~> 5.1.0)
|
51
|
+
rake
|
52
|
+
rspec (~> 3.4)
|
53
|
+
sqlite3
|
54
|
+
|
55
|
+
BUNDLED WITH
|
56
|
+
1.12.1
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module ActiveType
|
2
2
|
class TypeCaster
|
3
3
|
|
4
|
-
def self.get(type
|
4
|
+
def self.get(type)
|
5
5
|
native_caster = if ActiveRecord::VERSION::STRING < '4.2'
|
6
6
|
NativeCasters::DelegateToColumn.new(type)
|
7
7
|
elsif ActiveRecord::VERSION::STRING < '5'
|
8
|
-
NativeCasters::DelegateToRails4Type.new(type
|
8
|
+
NativeCasters::DelegateToRails4Type.new(type)
|
9
9
|
else
|
10
10
|
NativeCasters::DelegateToRails5Type.new(type)
|
11
11
|
end
|
@@ -66,21 +66,12 @@ module ActiveType
|
|
66
66
|
# In these versions, casting logic lives in subclasses of ActiveRecord::Type::Value
|
67
67
|
class DelegateToRails4Type
|
68
68
|
|
69
|
-
def initialize(type
|
69
|
+
def initialize(type)
|
70
70
|
# The specified type (e.g. "string") may not necessary match the
|
71
71
|
# native type ("varchar") expected by the connection adapter.
|
72
72
|
# PostgreSQL is one of these. Perform a translation if the adapter
|
73
73
|
# supports it (but don't turn a mysql boolean into a tinyint).
|
74
|
-
|
75
|
-
native_type = connection.native_database_types[type.to_sym]
|
76
|
-
if native_type && native_type[:name]
|
77
|
-
type = native_type[:name]
|
78
|
-
else
|
79
|
-
# unknown type, we just dont cast
|
80
|
-
type = nil
|
81
|
-
end
|
82
|
-
end
|
83
|
-
@active_record_type = connection.lookup_cast_type(type)
|
74
|
+
@active_record_type = ActiveRecord::ConnectionAdapters::AbstractAdapter.new(nil).lookup_cast_type(type)
|
84
75
|
end
|
85
76
|
|
86
77
|
def type_cast_from_user(value)
|
@@ -107,11 +98,9 @@ module ActiveType
|
|
107
98
|
if type.respond_to?(:cast)
|
108
99
|
type
|
109
100
|
else
|
110
|
-
ActiveRecord::
|
111
|
-
ActiveRecord::Type.lookup(type)
|
112
|
-
}
|
101
|
+
ActiveRecord::Type.lookup(type, adapter: nil)
|
113
102
|
end
|
114
|
-
rescue ::ArgumentError
|
103
|
+
rescue ::ArgumentError
|
115
104
|
ActiveRecord::Type::Value.new
|
116
105
|
end
|
117
106
|
|
data/lib/active_type/version.rb
CHANGED
@@ -46,7 +46,7 @@ module ActiveType
|
|
46
46
|
private
|
47
47
|
|
48
48
|
def add_virtual_column(name, type, options)
|
49
|
-
type_caster = TypeCaster.get(type
|
49
|
+
type_caster = TypeCaster.get(type)
|
50
50
|
column = VirtualColumn.new(name, type_caster, options.slice(:default))
|
51
51
|
@owner.virtual_columns_hash = @owner.virtual_columns_hash.merge(name.to_s => column)
|
52
52
|
end
|
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: 0.7.
|
4
|
+
version: 0.7.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: 2017-
|
12
|
+
date: 2017-06-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -82,12 +82,16 @@ files:
|
|
82
82
|
- gemfiles/Gemfile.4.2.1.pg.lock
|
83
83
|
- gemfiles/Gemfile.4.2.1.sqlite3
|
84
84
|
- gemfiles/Gemfile.4.2.1.sqlite3.lock
|
85
|
-
- gemfiles/Gemfile.5.0.0.mysql2
|
86
85
|
- gemfiles/Gemfile.5.0.0.mysql2.lock
|
87
|
-
- gemfiles/Gemfile.5.0.0.pg
|
88
86
|
- gemfiles/Gemfile.5.0.0.pg.lock
|
89
87
|
- gemfiles/Gemfile.5.0.0.sqlite3
|
90
88
|
- gemfiles/Gemfile.5.0.0.sqlite3.lock
|
89
|
+
- gemfiles/Gemfile.5.1.0.mysql2
|
90
|
+
- gemfiles/Gemfile.5.1.0.mysql2.lock
|
91
|
+
- gemfiles/Gemfile.5.1.0.pg
|
92
|
+
- gemfiles/Gemfile.5.1.0.pg.lock
|
93
|
+
- gemfiles/Gemfile.5.1.0.sqlite3
|
94
|
+
- gemfiles/Gemfile.5.1.0.sqlite3.lock
|
91
95
|
- lib/active_type.rb
|
92
96
|
- lib/active_type/extended_record.rb
|
93
97
|
- lib/active_type/extended_record/inheritance.rb
|