activerecord2-hstore 1.0.1 → 1.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/CHANGELOG +3 -0
- data/lib/activerecord2-hstore/hstore.rb +2 -1
- data/lib/activerecord2-hstore/version.rb +1 -1
- data/spec/hstore_spec.rb +5 -0
- metadata +5 -5
data/CHANGELOG
CHANGED
@@ -28,7 +28,8 @@ module Hstore
|
|
28
28
|
end
|
29
29
|
|
30
30
|
define_method "#{column}=".to_sym do |value|
|
31
|
-
value =
|
31
|
+
value = {} if value.nil?
|
32
|
+
value ||= value.is_a?(String) ? value : value.to_hstore
|
32
33
|
write_attribute(column.to_sym, value)
|
33
34
|
end
|
34
35
|
end
|
data/spec/hstore_spec.rb
CHANGED
@@ -55,6 +55,11 @@ describe Hstore do
|
|
55
55
|
subject.some_field = {:a => :b}
|
56
56
|
end
|
57
57
|
|
58
|
+
it "handles nil input" do
|
59
|
+
subject.should_receive(:write_attribute)
|
60
|
+
subject.some_field = nil
|
61
|
+
end
|
62
|
+
|
58
63
|
it "can also accept a hstore string instead of a hash" do
|
59
64
|
subject.stub(:write_attribute)
|
60
65
|
subject.some_field = "a=>b"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord2-hstore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tony Drake
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-07-27 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
requirements: []
|
135
135
|
|
136
136
|
rubyforge_project: activerecord2-hstore
|
137
|
-
rubygems_version: 1.8.
|
137
|
+
rubygems_version: 1.8.24
|
138
138
|
signing_key:
|
139
139
|
specification_version: 3
|
140
140
|
summary: Some basic support to help integrate Postgresql's HStore into a Rails 2.3 app
|