will_paginate 3.0.6 → 3.0.7

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: 2b4a394317f67e89d1bea01f567721310ee8a13c
4
- data.tar.gz: db08d65616e1e1f62e3cc8ec0da17703bd78dd3c
3
+ metadata.gz: 1868f72daf66f8ede4a9253c2b09f8f31b139491
4
+ data.tar.gz: 6c3e2f25535acb3ec0be32c3352d4007405debf8
5
5
  SHA512:
6
- metadata.gz: 6cbe6fabc2c9b57da7d9df6fa8408b0c9ff471a8c956db8af8a1d82e0430fd8cae1f89cc9898a5e9796288f411ae76fca939c3ec77647c6179c8f2c61b699847
7
- data.tar.gz: f58e6d478a08ea4c24494886d4d623b9f6ff2a2dca2c56d9261325179d8d4598426c20ebe947f8b8d6838cd90347a43e84396b1e367d10981b426eec2fb7b980
6
+ metadata.gz: 3ca8c0a4b2e6f3be74b770618fc46f54a729171936b5e39c46425b8c9e48aa61701713825a6a6ab973a93c732886f582366878235624901d06119f94a7ba675d
7
+ data.tar.gz: 1127948955580aa81cdaeea1e028f0abec34743e1047bfd659c3152d372bb41299ff7336710b8ef77aeb885b53241f077e93be90e000a1feeb6e602b72447607
@@ -90,7 +90,9 @@ module WillPaginate
90
90
  rel = self.except(*excluded)
91
91
  # TODO: hack. decide whether to keep
92
92
  rel = rel.apply_finder_options(@wp_count_options) if defined? @wp_count_options
93
- rel.count(*args)
93
+
94
+ column_name = (select_for_count(rel) || :all)
95
+ rel.count(column_name)
94
96
  else
95
97
  super(*args)
96
98
  end
@@ -143,6 +145,13 @@ module WillPaginate
143
145
  other.wp_count_options = @wp_count_options if defined? @wp_count_options
144
146
  other
145
147
  end
148
+
149
+ def select_for_count(rel)
150
+ if rel.select_values.present?
151
+ select = rel.select_values.join(", ")
152
+ select if select !~ /[,*]/
153
+ end
154
+ end
146
155
  end
147
156
 
148
157
  module Pagination
@@ -2,7 +2,7 @@ module WillPaginate #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 6
5
+ TINY = 7
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -200,6 +200,10 @@ describe WillPaginate::ActiveRecord do
200
200
  it "should count with group" do
201
201
  Developer.group(:salary).page(1).total_entries.should == 4
202
202
  end
203
+
204
+ it "should count with select" do
205
+ Topic.select('title, content').page(1).total_entries.should == 4
206
+ end
203
207
 
204
208
  it "removes :reorder for count with group" do
205
209
  Project.group(:id).reorder(:id).page(1).total_entries
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: will_paginate
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6
4
+ version: 3.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mislav Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-28 00:00:00.000000000 Z
11
+ date: 2014-07-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: will_paginate provides a simple API for performing paginated queries
14
14
  with Active Record, DataMapper and Sequel, and includes helpers for rendering pagination