activerecord-postgres-hstore 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 0.7.3 / 2013-02-07
2
+
3
+ * Enhancements
4
+ * Always use empty hash as default value
5
+
6
+
1
7
  0.7.2 / 2013-02-07
2
8
 
3
9
  * Bug fixes
data/README.md CHANGED
@@ -97,15 +97,6 @@ class Person < ActiveRecord::Base
97
97
  end
98
98
  ```
99
99
 
100
- If you want a default value (say, an empty hash) you should pass it as an argument when you
101
- initialize the serializer, like so:
102
-
103
- ```ruby
104
- class Person < ActiveRecord::Base
105
- serialize :data, ActiveRecord::Coders::Hstore.new({})
106
- end
107
- ```
108
-
109
100
  This way, you will automatically start with an empty hash that you can write attributes to.
110
101
 
111
102
  irb(main):001:0> person = Person.new
@@ -113,11 +104,6 @@ This way, you will automatically start with an empty hash that you can write att
113
104
  irb(main):002:0> person.data['favorite_color'] = 'blue'
114
105
  => "blue"
115
106
 
116
- If you skip this step, you will have to manually initialize the value to an empty hash before
117
- writing to the attribute, or else you will get an error:
118
-
119
- NoMethodError: undefined method `[]=' for nil:NilClass
120
-
121
107
  ###Querying the database
122
108
 
123
109
  Now you just need to learn a little bit of new
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "activerecord-postgres-hstore"
7
- s.version = "0.7.2"
7
+ s.version = "0.7.3"
8
8
 
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.license = "MIT"
@@ -4,11 +4,11 @@ module ActiveRecord
4
4
  module Coders
5
5
  class Hstore
6
6
  def self.load(hstore)
7
- new.load(hstore)
7
+ new({}).load(hstore)
8
8
  end
9
9
 
10
10
  def self.dump(hstore)
11
- new.dump(hstore)
11
+ new({}).dump(hstore)
12
12
  end
13
13
 
14
14
  def initialize(default=nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgres-hstore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: