activerecord-sqlserver-adapter 3.2.5 → 3.2.6

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.
data/CHANGELOG CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ * 3.2.6 *
3
+
4
+ * Unique has_many associations with pagination now work. Fixes #209
5
+
6
+
2
7
  * 3.2.5 *
3
8
 
4
9
  * Fix a few test from ActiveRecord 3.2.6 upgrade.
@@ -3,7 +3,7 @@ module ActiveRecord
3
3
  module Sqlserver
4
4
  module Version
5
5
 
6
- VERSION = '3.2.5'
6
+ VERSION = '3.2.6'
7
7
 
8
8
  end
9
9
  end
@@ -154,7 +154,7 @@ module Arel
154
154
  projections = projections.map { |x| projection_without_expression(x) }
155
155
  end
156
156
  [ ("SELECT" if !windowed),
157
- (visit(core.set_quantifier) if core.set_quantifier),
157
+ (visit(core.set_quantifier) if core.set_quantifier && !windowed),
158
158
  (visit(o.limit) if o.limit && !windowed),
159
159
  (projections.map{ |x| v = visit(x); v == "1" ? "1 AS [__wrp]" : v }.join(', ')),
160
160
  (source_with_lock_for_select_statement(o)),
@@ -166,13 +166,14 @@ module Arel
166
166
  end
167
167
 
168
168
  def visit_Arel_Nodes_SelectStatementWithOffset(o)
169
+ core = o.cores.first
169
170
  o.limit ||= Arel::Nodes::Limit.new(9223372036854775807)
170
171
  orders = rowtable_orders(o)
171
172
  [ "SELECT",
172
173
  (visit(o.limit) if o.limit && !windowed_single_distinct_select_statement?(o)),
173
174
  (rowtable_projections(o).map{ |x| visit(x) }.join(', ')),
174
175
  "FROM (",
175
- "SELECT ROW_NUMBER() OVER (ORDER BY #{orders.map{ |x| visit(x) }.join(', ')}) AS [__rn],",
176
+ "SELECT #{core.set_quantifier ? 'DISTINCT DENSE_RANK()' : 'ROW_NUMBER()'} OVER (ORDER BY #{orders.map{ |x| visit(x) }.join(', ')}) AS [__rn],",
176
177
  visit_Arel_Nodes_SelectStatementWithOutOffset(o,true),
177
178
  ") AS [__rnt]",
178
179
  (visit(o.offset) if o.offset),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-sqlserver-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.5
4
+ version: 3.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,11 +13,11 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2012-06-22 00:00:00.000000000 Z
16
+ date: 2012-07-08 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: activerecord
20
- requirement: &70190121497380 !ruby/object:Gem::Requirement
20
+ requirement: &70121348787340 !ruby/object:Gem::Requirement
21
21
  none: false
22
22
  requirements:
23
23
  - - ~>
@@ -25,7 +25,7 @@ dependencies:
25
25
  version: 3.2.0
26
26
  type: :runtime
27
27
  prerelease: false
28
- version_requirements: *70190121497380
28
+ version_requirements: *70121348787340
29
29
  description: SQL Server 2005 and 2008 Adapter For ActiveRecord
30
30
  email: ken@metaskills.net
31
31
  executables: []