active_type 0.3.2 → 0.3.3
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/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.lock +1 -1
- data/gemfiles/Gemfile.4.2.pg.lock +1 -1
- data/lib/active_type/type_caster.rb +6 -1
- data/lib/active_type/version.rb +1 -1
- data/spec/active_type/object_spec.rb +11 -0
- 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: f3cef4ee7f980941d6ce98ea722f3be8d926147d
|
4
|
+
data.tar.gz: 789c82e02dc5689747cb2e0d9ee78f390f00e4de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfe7272f70e29e0ee3ec6ab1e085ee1dd2ae77539911417a58505ea29f8b4609d185d4d37ccf50e287d10e5196ff7a9885493601327457a939317e48d8440086
|
7
|
+
data.tar.gz: f6b631538c8fee8e0d0636ad532e13f6ce9ca2b9c2c624e042ea64f9b86eaef27f835cb291458ca806641f8d3b01405fddd35ae8f0197274838d3d463947ca8f
|
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.lock
CHANGED
@@ -71,7 +71,12 @@ module ActiveType
|
|
71
71
|
# supports it.
|
72
72
|
if !type.nil? && connection.respond_to?(:native_database_types)
|
73
73
|
native_type = connection.native_database_types[type.to_sym]
|
74
|
-
|
74
|
+
if native_type && native_type[:name]
|
75
|
+
type = native_type[:name]
|
76
|
+
else
|
77
|
+
# unknown type, we just dont cast
|
78
|
+
type = nil
|
79
|
+
end
|
75
80
|
end
|
76
81
|
@active_record_type = connection.lookup_cast_type(type)
|
77
82
|
end
|
data/lib/active_type/version.rb
CHANGED
@@ -79,6 +79,10 @@ module ObjectSpec
|
|
79
79
|
|
80
80
|
end
|
81
81
|
|
82
|
+
class ObjectWithUnsupportedTypes < Object
|
83
|
+
attribute :virtual_array, :array
|
84
|
+
attribute :virtual_hash, :hash
|
85
|
+
end
|
82
86
|
|
83
87
|
end
|
84
88
|
|
@@ -102,6 +106,13 @@ describe ActiveType::Object do
|
|
102
106
|
it_should_behave_like 'ActiveRecord-like accessors', { :virtual_string => "string", :virtual_integer => 100, :virtual_time => Time.now, :virtual_date => Date.today, :virtual_boolean => true }
|
103
107
|
end
|
104
108
|
|
109
|
+
describe 'unsupported types' do
|
110
|
+
subject { ObjectSpec::ObjectWithUnsupportedTypes.new }
|
111
|
+
|
112
|
+
it_should_behave_like 'ActiveRecord-like mass assignment', { :virtual_hash => {'foo' => 'bar'}, :virtual_array => ['foo', 'bar'] }
|
113
|
+
it_should_behave_like 'ActiveRecord-like accessors', { :virtual_hash => {'foo' => 'bar'}, :virtual_array => ['foo', 'bar'] }
|
114
|
+
end
|
115
|
+
|
105
116
|
describe 'overridable attributes' do
|
106
117
|
subject { ObjectSpec::ObjectWithOverrides.new }
|
107
118
|
|
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.3
|
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: 2015-01-
|
12
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|