surus 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a513dd97a43e25dbe91de60dee39323f42b410a
4
- data.tar.gz: 092f7b1ea714785b14f59f68088f33101ae57244
3
+ metadata.gz: 8c16570a2c0344b5f4294041a7a6b6e0e5d03674
4
+ data.tar.gz: b28d6a4a328a01228cbaef0eb6d2024199e5cd64
5
5
  SHA512:
6
- metadata.gz: 111bcea66d6e02e09a8b7314e3768399dd55422ecb403305461bdd4d4f16fcc62f97181d41e6cbf7551fdd4772201bbcdc9d7f5b9a77c2f3ce0482efe0a64d3c
7
- data.tar.gz: e4e759ac1c896166afae2e26033667b30f88f578ba1a9dc3c3caef6374252b3a19cc1491d397dd1dc11ea383e45d15246e779f97eacee2219124eed47ff52473
6
+ metadata.gz: d610452b370a09fa5ae3b3a131e17439d52b625b827924cc15cc17d226b6df86f2310feed010028dda5541c675e5e36b5eab196dcca0123a8a6411108f922916
7
+ data.tar.gz: 7ba624e05ff271e1b4587c16101adba2616b5e070ae35415dc96221a542eb33a67537f8492777049afed5d676cd6f6c8181ec020b31ed403031068ad29400d76
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 0.5.1 (August 29, 2014)
2
+
3
+ * Quote assocation column names
4
+ * Omitting 'as' results in syntax error with belongs to relationship (Michael J. Cohen)
5
+ * Fix (find|all)_json when scope chain has joins with ambiguous names
6
+
7
+ # 0.5.0 (August 19, 2013)
8
+
9
+ * Rails 4 support
10
+
1
11
  # 0.4.2 (June 21, 2013)
2
12
 
3
13
  * Make pg a development dependency to allow usage with JRuby
@@ -30,7 +30,9 @@ module Surus
30
30
  if options.key? :columns
31
31
  options[:columns]
32
32
  else
33
- table_columns.map(&:name)
33
+ table_columns.map do |c|
34
+ "#{quoted_table_name}.#{connection.quote_column_name c.name}"
35
+ end
34
36
  end
35
37
  end
36
38
 
@@ -48,7 +50,7 @@ module Surus
48
50
  association_scope = HasAndBelongsToManyScopeBuilder.new(original_scope, association).scope
49
51
  ArrayAggQuery.new(association_scope, association_options).to_sql
50
52
  end
51
- "(#{subquery}) #{association_name}"
53
+ "(#{subquery}) #{connection.quote_column_name association_name}"
52
54
  end
53
55
  end
54
56
 
data/lib/surus/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Surus
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -22,6 +22,16 @@ describe 'json' do
22
22
  end
23
23
  end
24
24
 
25
+ context 'when scope chain has a joins with ambiguous column names' do
26
+ it 'works' do
27
+ user = FactoryGirl.create :user
28
+ FactoryGirl.create :post, author: user
29
+ to_json = Oj.load user.to_json
30
+ find_json = Oj.load User.joins(:posts).find_json(user.id)
31
+ expect(find_json).to eq(to_json)
32
+ end
33
+ end
34
+
25
35
  context 'with includes option' do
26
36
  it 'includes entire belongs_to object' do
27
37
  post = FactoryGirl.create :post
@@ -94,6 +104,15 @@ describe 'json' do
94
104
  expect(find_json).to eq(to_json)
95
105
  end
96
106
 
107
+ it 'includes has_many association with a PostgreSQL reserved word as name' do
108
+ user = FactoryGirl.create :user
109
+ posts = FactoryGirl.create_list :post, 2, author: user
110
+ user.reload
111
+ to_json = Oj.load user.to_json(include: :rows)
112
+ find_json = Oj.load User.find_json(user.id, include: :rows)
113
+ expect(find_json).to eq(to_json)
114
+ end
115
+
97
116
  it 'includes entire has_and_belongs_to_many association' do
98
117
  post = FactoryGirl.create :post
99
118
  tag = FactoryGirl.create :tag
data/spec/spec_helper.rb CHANGED
@@ -27,6 +27,9 @@ class User < ActiveRecord::Base
27
27
  -> { where subject: 'foo' },
28
28
  foreign_key: :author_id,
29
29
  class_name: 'Post'
30
+
31
+ # association name is reserved word in PostgreSQL
32
+ has_many :rows, foreign_key: :author_id, class_name: 'Post', table_name: 'posts'
30
33
  end
31
34
 
32
35
  class Forum < ActiveRecord::Base
data/surus.gemspec CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
14
14
  It also can control PostgreSQL synchronous commit behavior. By relaxing
15
15
  PostgreSQL's durability guarantee, transaction commit rate can be increased by
16
16
  50% or more. }
17
+ s.license = 'MIT'
17
18
 
18
19
  s.rubyforge_project = ""
19
20
 
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Christensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-19 00:00:00.000000000 Z
11
+ date: 2014-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.12.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.12.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: guard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.10.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.10.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: guard-rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.6.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.6.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rb-fsevent
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.9.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.9.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: oj
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 2.0.2
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 2.0.2
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pg
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.9.11
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.9.11
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: factory_girl
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: 4.2.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 4.2.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: faker
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: 1.1.2
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 1.1.2
153
153
  description: "Surus accelerates ActiveRecord with PostgreSQL specific types and\n
@@ -161,8 +161,8 @@ executables: []
161
161
  extensions: []
162
162
  extra_rdoc_files: []
163
163
  files:
164
- - .gitignore
165
- - .rspec
164
+ - ".gitignore"
165
+ - ".rspec"
166
166
  - CHANGELOG.md
167
167
  - Gemfile
168
168
  - Guardfile
@@ -205,7 +205,8 @@ files:
205
205
  - surus.gemspec
206
206
  - tmp/rspec_guard_result
207
207
  homepage: https://github.com/JackC/surus
208
- licenses: []
208
+ licenses:
209
+ - MIT
209
210
  metadata: {}
210
211
  post_install_message:
211
212
  rdoc_options: []
@@ -213,17 +214,17 @@ require_paths:
213
214
  - lib
214
215
  required_ruby_version: !ruby/object:Gem::Requirement
215
216
  requirements:
216
- - - '>='
217
+ - - ">="
217
218
  - !ruby/object:Gem::Version
218
219
  version: '0'
219
220
  required_rubygems_version: !ruby/object:Gem::Requirement
220
221
  requirements:
221
- - - '>='
222
+ - - ">="
222
223
  - !ruby/object:Gem::Version
223
224
  version: '0'
224
225
  requirements: []
225
226
  rubyforge_project: ''
226
- rubygems_version: 2.0.3
227
+ rubygems_version: 2.2.2
227
228
  signing_key:
228
229
  specification_version: 4
229
230
  summary: PostgreSQL Acceleration for ActiveRecord
@@ -238,4 +239,3 @@ test_files:
238
239
  - spec/spec_helper.rb
239
240
  - spec/synchronous_commit/connection_spec.rb
240
241
  - spec/synchronous_commit/model_spec.rb
241
- has_rdoc: