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 +6 -0
- data/README.md +0 -14
- data/activerecord-postgres-hstore.gemspec +1 -1
- data/lib/activerecord-postgres-hstore/coder.rb +2 -2
- metadata +1 -1
data/CHANGELOG
CHANGED
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
|