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 +4 -4
- data/lib/will_paginate/active_record.rb +10 -1
- data/lib/will_paginate/version.rb +1 -1
- data/spec/finders/active_record_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1868f72daf66f8ede4a9253c2b09f8f31b139491
|
4
|
+
data.tar.gz: 6c3e2f25535acb3ec0be32c3352d4007405debf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
@@ -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.
|
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-
|
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
|