activerecord-postgres-hstore 0.7.7 → 0.7.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c1fd061cb95d1132d2674b9e5a3cb7fb5f52787
4
- data.tar.gz: 23162c6b3a46e204db025686510fd155fc36fc8c
3
+ metadata.gz: f8a097b039fc5e79ea75d5b70769919d0764ed62
4
+ data.tar.gz: 663c6a674cdca0d17af52c40093539db331e8085
5
5
  SHA512:
6
- metadata.gz: e1ac2b3843f7e9e89bc1f211b8ebb12b66ab6d2d54ee2afe192e8e4d8376597843fded72e9cc2a912cf90933e164384cbd7b57e718fbbc4fd51c9a6a36d7affd
7
- data.tar.gz: 30dea4ce9d3238e1f488828628f36d12dbdf0dc6124c333af75f5f7ffaca922694dda3c83d93850c1dab9d27e28b79bf65b0a477a22d77e54dbceeab6d398009
6
+ metadata.gz: 3684335e57f842bb15862ac44e59087dd2eef9159cb69e7192c70e66cd239bea278f29246207e133af7aa528dd1a55f28206a4159b8e33829dc6d51234be6b96
7
+ data.tar.gz: 403581dc85c0797624c9b2d55908271b4ed8574dc84ceaa6270133d28f4220cc629c7958a52602b1bc254c955814b74b26d4f790fa24ef4467a3617e1d669c68
@@ -1,8 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.2
4
6
  - jruby-19mode
5
- - rbx-19mode
7
+ - rbx-2
6
8
  - ruby-head
7
9
  - jruby-head
8
10
 
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  #Goodbye serialize, hello hstore.
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/diogob/activerecord-postgres-hstore.png?branch=master)](http://travis-ci.org/diogob/activerecord-postgres-hstore)
4
- [![Code Climate](https://codeclimate.com/github/diogob/activerecord-postgres-hstore.png)](https://codeclimate.com/github/diogob/activerecord-postgres-hstore)
3
+ [![Build Status](https://secure.travis-ci.org/diogob/activerecord-postgres-hstore.svg?branch=master)](http://travis-ci.org/diogob/activerecord-postgres-hstore)
4
+ [![Code Climate](https://codeclimate.com/github/diogob/activerecord-postgres-hstore.svg)](https://codeclimate.com/github/diogob/activerecord-postgres-hstore)
5
5
 
6
6
  You need dynamic columns in your tables. What do you do?
7
7
 
@@ -21,6 +21,48 @@ user = User.create settings: {theme: 'navy'}
21
21
  user.settings['theme']
22
22
  ```
23
23
 
24
+ ##Note about Rails 4
25
+
26
+ If you are using Rails 4 you don't need this gem as ActiveRecord 4 provides HStore type support out of the box. ActiveRecord will see your HStore column and do all of the work for you. **Additional code is no longer needed.**
27
+
28
+ You can test it with a migration like this:
29
+ ```ruby
30
+ class CreateTest < ActiveRecord::Migration
31
+ def change
32
+ create_table :tests do |t|
33
+ t.hstore :data
34
+ end
35
+ end
36
+ end
37
+ ```
38
+
39
+ Its model:
40
+ ```ruby
41
+ class Test < ActiveRecord::Base
42
+ # before Rails 4, we'd have to this here:
43
+ # serialize :data, ActiveRecord::Coders::Hstore
44
+ end
45
+ ```
46
+
47
+ Then you can use the hash field straight away:
48
+ ```ruby
49
+ irb(main):003:0> t = Test.new data: {a: 1, b:2}
50
+ => #<Test id: nil, data: {"a"=>"1", "b"=>"2"}>
51
+ irb(main):004:0> t.save!
52
+ (0.3ms) BEGIN
53
+ SQL (2.3ms) INSERT INTO "tests" ("data") VALUES ($1) RETURNING "id" [["data", "\"a\"=>\"1\",\"b\"=>\"2\""]]
54
+ (0.5ms) COMMIT
55
+ => true
56
+ irb(main):005:0> t
57
+ => #<Test id: 1, data: {"a"=>"1", "b"=>"2"}>
58
+ irb(main):006:0> t.data
59
+ => {"a"=>"1", "b"=>"2"}
60
+ irb(main):007:0> t.data['a']
61
+ => "1"
62
+ ```
63
+
64
+ For more information take a look [here](http://jes.al/2013/11/using-postgres-hstore-rails4/)
65
+
24
66
  ##Note about 0.7
25
67
 
26
68
  I have decided to clean up the old code and provide only a custom serializer in this new version.
@@ -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.7"
7
+ s.version = "0.7.8"
8
8
 
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.license = "MIT"
@@ -181,4 +181,21 @@ module ActiveRecord
181
181
 
182
182
  end
183
183
  end
184
+
185
+ class Migration
186
+ class CommandRecorder
187
+ [:add_hstore_index, :remove_hstore_index].each do |method|
188
+ class_eval <<-EOV, __FILE__, __LINE__ + 1
189
+ def #{method}(*args) # def create_table(*args)
190
+ record(:"#{method}", args) # record(:create_table, args)
191
+ end # end
192
+ EOV
193
+ end
194
+
195
+ private
196
+ def invert_add_hstore_index(args)
197
+ [:remove_hstore_index, args.first(2)]
198
+ end
199
+ end
200
+ end
184
201
  end
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.7
4
+ version: 0.7.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Maiz
@@ -9,90 +9,90 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-19 00:00:00.000000000 Z
12
+ date: 2015-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '3.1'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '3.1'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: pg-hstore
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: 1.1.5
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: 1.1.5
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: bundler
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rdoc
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rspec
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ~>
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
90
  version: '2.11'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ~>
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
97
  version: '2.11'
98
98
  description: This gem adds support for the postgres hstore type. It is the _just right_
@@ -102,10 +102,10 @@ executables: []
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
- - .document
106
- - .gitignore
107
- - .rspec
108
- - .travis.yml
105
+ - ".document"
106
+ - ".gitignore"
107
+ - ".rspec"
108
+ - ".travis.yml"
109
109
  - CHANGELOG
110
110
  - Gemfile
111
111
  - LICENSE
@@ -132,17 +132,17 @@ require_paths:
132
132
  - lib
133
133
  required_ruby_version: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - '>='
135
+ - - ">="
136
136
  - !ruby/object:Gem::Version
137
137
  version: 1.8.7
138
138
  required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  requirements:
140
- - - '>='
140
+ - - ">="
141
141
  - !ruby/object:Gem::Version
142
142
  version: 1.3.6
143
143
  requirements: []
144
144
  rubyforge_project:
145
- rubygems_version: 2.0.7
145
+ rubygems_version: 2.4.5.1
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: Goodbye serialize, hello hstore