nested-hstore 0.0.1 → 0.0.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.
data/README.md
CHANGED
@@ -13,7 +13,11 @@ module ActiveRecord
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def from_hstore hstore
|
16
|
-
|
16
|
+
if ActiveRecord::VERSION::MAJOR >= 4
|
17
|
+
@nested_serializer.deserialize(hstore)
|
18
|
+
else
|
19
|
+
@nested_serializer.deserialize(super)
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
19
23
|
end
|
@@ -103,11 +103,10 @@ module NestedHstore
|
|
103
103
|
# This isn't ideal: how do we know whether each value in an hstore is JSON or a
|
104
104
|
# string/integer/etc?
|
105
105
|
def decode_json_if_json(value)
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
end
|
106
|
+
return value unless value.start_with?('{') && value.end_with?('}')
|
107
|
+
ActiveSupport::JSON.decode(value)
|
108
|
+
rescue
|
109
|
+
value
|
111
110
|
end
|
112
111
|
|
113
112
|
def encode_json(value)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nested-hstore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|