active_type 0.3.1 → 0.3.2
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/.travis.yml +21 -0
- data/README.md +1 -1
- data/gemfiles/Gemfile.3.2.lock +1 -1
- data/gemfiles/Gemfile.4.0.lock +1 -1
- data/gemfiles/Gemfile.4.1.lock +1 -1
- data/gemfiles/Gemfile.4.2 +1 -1
- data/gemfiles/Gemfile.4.2.lock +15 -15
- data/gemfiles/Gemfile.4.2.pg +7 -0
- data/gemfiles/Gemfile.4.2.pg.lock +49 -0
- data/lib/active_type/no_table.rb +8 -0
- data/lib/active_type/type_caster.rb +8 -0
- data/lib/active_type/version.rb +1 -1
- data/spec/active_type/object_spec.rb +6 -1
- data/spec/support/database.rb +16 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a2d3c1730d1b0d1175a5ef12eba8ec4f4d39ebbf
|
|
4
|
+
data.tar.gz: 0bec41f0aaf446a3e96cd006181848e61e293abe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 05954c59d026aa8b6ec4e4d300287e467fddd527ed788cf0cade8b9da45b6a46f6997990b61b94a2a030c79517057252fa5074af3c6ff9191f97647f95b0db0c
|
|
7
|
+
data.tar.gz: e966f0029d64e54bf391866d6485abd5f783b9b810b7340207c609c0db66ca558136c84af92db8b236761b7bf069c53cea45209c6136fc830816309a700696ce
|
data/.travis.yml
CHANGED
|
@@ -4,10 +4,15 @@ rvm:
|
|
|
4
4
|
- "1.9.3"
|
|
5
5
|
- "2.0.0"
|
|
6
6
|
- "2.1.2"
|
|
7
|
+
- "2.2.0"
|
|
7
8
|
gemfile:
|
|
8
9
|
- gemfiles/Gemfile.3.2
|
|
9
10
|
- gemfiles/Gemfile.4.0
|
|
10
11
|
- gemfiles/Gemfile.4.1
|
|
12
|
+
- gemfiles/Gemfile.4.2
|
|
13
|
+
- gemfiles/Gemfile.4.2.pg
|
|
14
|
+
before_script:
|
|
15
|
+
- psql -c 'create database active_type_test;' -U postgres
|
|
11
16
|
script: bundle exec rspec spec
|
|
12
17
|
notifications:
|
|
13
18
|
email:
|
|
@@ -21,3 +26,19 @@ matrix:
|
|
|
21
26
|
gemfile: gemfiles/Gemfile.4.0
|
|
22
27
|
- rvm: "1.8.7"
|
|
23
28
|
gemfile: gemfiles/Gemfile.4.1
|
|
29
|
+
- rvm: "1.8.7"
|
|
30
|
+
gemfile: gemfiles/Gemfile.4.2
|
|
31
|
+
- rvm: "1.8.7"
|
|
32
|
+
gemfile: gemfiles/Gemfile.4.2.pg
|
|
33
|
+
- rvm: "1.9.3"
|
|
34
|
+
gemfile: gemfiles/Gemfile.4.2.pg
|
|
35
|
+
- rvm: "2.0.0"
|
|
36
|
+
gemfile: gemfiles/Gemfile.4.2.pg
|
|
37
|
+
- rvm: "2.1.2"
|
|
38
|
+
gemfile: gemfiles/Gemfile.3.2
|
|
39
|
+
- rvm: "2.1.2"
|
|
40
|
+
gemfile: gemfiles/Gemfile.4.0
|
|
41
|
+
- rvm: "2.2.0"
|
|
42
|
+
gemfile: gemfiles/Gemfile.3.2
|
|
43
|
+
- rvm: "2.2.0"
|
|
44
|
+
gemfile: gemfiles/Gemfile.4.0
|
data/README.md
CHANGED
|
@@ -274,7 +274,7 @@ Supported options for `nests_many` / `nests_one` are:
|
|
|
274
274
|
Supported Rails versions
|
|
275
275
|
------------------------
|
|
276
276
|
|
|
277
|
-
ActiveType is tested against ActiveRecord 3.2, 4.0, 4.1 and 4.
|
|
277
|
+
ActiveType is tested against ActiveRecord 3.2, 4.0, 4.1 and 4.2.
|
|
278
278
|
|
|
279
279
|
Later versions might work, earlier will not.
|
|
280
280
|
|
data/gemfiles/Gemfile.3.2.lock
CHANGED
data/gemfiles/Gemfile.4.0.lock
CHANGED
data/gemfiles/Gemfile.4.1.lock
CHANGED
data/gemfiles/Gemfile.4.2
CHANGED
data/gemfiles/Gemfile.4.2.lock
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ..
|
|
3
3
|
specs:
|
|
4
|
-
active_type (0.3.
|
|
4
|
+
active_type (0.3.2)
|
|
5
5
|
activerecord (>= 3.2)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
activemodel (4.2.0
|
|
11
|
-
activesupport (= 4.2.0
|
|
10
|
+
activemodel (4.2.0)
|
|
11
|
+
activesupport (= 4.2.0)
|
|
12
12
|
builder (~> 3.1)
|
|
13
|
-
activerecord (4.2.0
|
|
14
|
-
activemodel (= 4.2.0
|
|
15
|
-
activesupport (= 4.2.0
|
|
16
|
-
arel (
|
|
17
|
-
activesupport (4.2.0
|
|
18
|
-
i18n (
|
|
13
|
+
activerecord (4.2.0)
|
|
14
|
+
activemodel (= 4.2.0)
|
|
15
|
+
activesupport (= 4.2.0)
|
|
16
|
+
arel (~> 6.0)
|
|
17
|
+
activesupport (4.2.0)
|
|
18
|
+
i18n (~> 0.7)
|
|
19
19
|
json (~> 1.7, >= 1.7.7)
|
|
20
20
|
minitest (~> 5.1)
|
|
21
|
-
thread_safe (~> 0.
|
|
21
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
|
22
22
|
tzinfo (~> 1.1)
|
|
23
|
-
arel (6.0.0
|
|
23
|
+
arel (6.0.0)
|
|
24
24
|
builder (3.2.2)
|
|
25
25
|
diff-lcs (1.2.5)
|
|
26
|
-
i18n (0.7.0
|
|
27
|
-
json (1.8.
|
|
28
|
-
minitest (5.
|
|
26
|
+
i18n (0.7.0)
|
|
27
|
+
json (1.8.2)
|
|
28
|
+
minitest (5.5.1)
|
|
29
29
|
rspec (2.14.1)
|
|
30
30
|
rspec-core (~> 2.14.0)
|
|
31
31
|
rspec-expectations (~> 2.14.0)
|
|
@@ -44,6 +44,6 @@ PLATFORMS
|
|
|
44
44
|
|
|
45
45
|
DEPENDENCIES
|
|
46
46
|
active_type!
|
|
47
|
-
activerecord (~> 4.2.0
|
|
47
|
+
activerecord (~> 4.2.0)
|
|
48
48
|
rspec (< 2.99)
|
|
49
49
|
sqlite3
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
active_type (0.3.2)
|
|
5
|
+
activerecord (>= 3.2)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
activemodel (4.2.0)
|
|
11
|
+
activesupport (= 4.2.0)
|
|
12
|
+
builder (~> 3.1)
|
|
13
|
+
activerecord (4.2.0)
|
|
14
|
+
activemodel (= 4.2.0)
|
|
15
|
+
activesupport (= 4.2.0)
|
|
16
|
+
arel (~> 6.0)
|
|
17
|
+
activesupport (4.2.0)
|
|
18
|
+
i18n (~> 0.7)
|
|
19
|
+
json (~> 1.7, >= 1.7.7)
|
|
20
|
+
minitest (~> 5.1)
|
|
21
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
|
22
|
+
tzinfo (~> 1.1)
|
|
23
|
+
arel (6.0.0)
|
|
24
|
+
builder (3.2.2)
|
|
25
|
+
diff-lcs (1.2.5)
|
|
26
|
+
i18n (0.7.0)
|
|
27
|
+
json (1.8.2)
|
|
28
|
+
minitest (5.5.1)
|
|
29
|
+
pg (0.18.1)
|
|
30
|
+
rspec (2.14.1)
|
|
31
|
+
rspec-core (~> 2.14.0)
|
|
32
|
+
rspec-expectations (~> 2.14.0)
|
|
33
|
+
rspec-mocks (~> 2.14.0)
|
|
34
|
+
rspec-core (2.14.8)
|
|
35
|
+
rspec-expectations (2.14.5)
|
|
36
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
37
|
+
rspec-mocks (2.14.6)
|
|
38
|
+
thread_safe (0.3.4)
|
|
39
|
+
tzinfo (1.2.2)
|
|
40
|
+
thread_safe (~> 0.1)
|
|
41
|
+
|
|
42
|
+
PLATFORMS
|
|
43
|
+
ruby
|
|
44
|
+
|
|
45
|
+
DEPENDENCIES
|
|
46
|
+
active_type!
|
|
47
|
+
activerecord (~> 4.2.0)
|
|
48
|
+
pg
|
|
49
|
+
rspec (< 2.99)
|
data/lib/active_type/no_table.rb
CHANGED
|
@@ -65,6 +65,14 @@ module ActiveType
|
|
|
65
65
|
class DelegateToType
|
|
66
66
|
|
|
67
67
|
def initialize(type, connection)
|
|
68
|
+
# The specified type (e.g. "string") may not necessary match the
|
|
69
|
+
# native type ("varchar") expected by the connection adapter.
|
|
70
|
+
# PostgreSQL is one of these. Perform a translation if the adapter
|
|
71
|
+
# supports it.
|
|
72
|
+
if !type.nil? && connection.respond_to?(:native_database_types)
|
|
73
|
+
native_type = connection.native_database_types[type.to_sym]
|
|
74
|
+
type = native_type.fetch(:name) unless native_type.nil?
|
|
75
|
+
end
|
|
68
76
|
@active_record_type = connection.lookup_cast_type(type)
|
|
69
77
|
end
|
|
70
78
|
|
data/lib/active_type/version.rb
CHANGED
|
@@ -329,9 +329,14 @@ describe ActiveType::Object do
|
|
|
329
329
|
|
|
330
330
|
describe '.find' do
|
|
331
331
|
it 'raises an error' do
|
|
332
|
+
error = if ActiveRecord::VERSION::MAJOR >= 4 && ActiveRecord::VERSION::MINOR >= 1
|
|
333
|
+
ActiveRecord::UnknownPrimaryKey
|
|
334
|
+
else
|
|
335
|
+
ActiveRecord::RecordNotFound
|
|
336
|
+
end
|
|
332
337
|
expect do
|
|
333
338
|
ObjectSpec::Object.find(1)
|
|
334
|
-
end.to raise_error(
|
|
339
|
+
end.to raise_error(error)
|
|
335
340
|
end
|
|
336
341
|
end
|
|
337
342
|
|
data/spec/support/database.rb
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
begin
|
|
2
|
+
# sqlite?
|
|
3
|
+
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
|
|
4
|
+
rescue Gem::LoadError
|
|
5
|
+
# pg?
|
|
6
|
+
if ENV['TRAVIS']
|
|
7
|
+
ActiveRecord::Base.establish_connection(:adapter => 'postgresql', :database => 'active_type_test', :username => 'postgres')
|
|
8
|
+
else
|
|
9
|
+
ActiveRecord::Base.establish_connection(:adapter => 'postgresql', :database => 'active_type_test')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
connection = ::ActiveRecord::Base.connection
|
|
13
|
+
connection.tables.each do |table|
|
|
14
|
+
connection.drop_table table
|
|
15
|
+
end
|
|
16
|
+
end
|
|
2
17
|
|
|
3
18
|
ActiveRecord::Migration.class_eval do
|
|
4
19
|
|
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.3.
|
|
4
|
+
version: 0.3.2
|
|
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: 2015-01-22 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -74,6 +74,8 @@ files:
|
|
|
74
74
|
- gemfiles/Gemfile.4.1.lock
|
|
75
75
|
- gemfiles/Gemfile.4.2
|
|
76
76
|
- gemfiles/Gemfile.4.2.lock
|
|
77
|
+
- gemfiles/Gemfile.4.2.pg
|
|
78
|
+
- gemfiles/Gemfile.4.2.pg.lock
|
|
77
79
|
- lib/active_type.rb
|
|
78
80
|
- lib/active_type/extended_record.rb
|
|
79
81
|
- lib/active_type/extended_record/inheritance.rb
|