activerecord2-hstore 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 1.0.2
2
+ * Corrected ActiveRecord setter to allow for nil input
3
+
1
4
  1.0.1
2
5
  * Corrected Hash.to_hstore to take into account apostrophes (Thanks, sisk)
3
6
 
@@ -28,7 +28,8 @@ module Hstore
28
28
  end
29
29
 
30
30
  define_method "#{column}=".to_sym do |value|
31
- value = value.is_a?(String) ? value : value.to_hstore
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
@@ -1,5 +1,5 @@
1
1
  module Activerecord2
2
2
  module Hstore
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  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: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
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-03-13 00:00:00 Z
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.10
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