will_paginate 2.3.16 → 2.3.17

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of will_paginate might be problematic. Click here for more details.

@@ -97,7 +97,8 @@ module WillPaginate
97
97
  # See {Faking Cursors in ActiveRecord}[http://weblog.jamisbuck.org/2007/4/6/faking-cursors-in-activerecord]
98
98
  # where Jamis Buck describes this and a more efficient way for MySQL.
99
99
  def paginated_each(options = {})
100
- options = { :order => 'id', :page => 1 }.merge options
100
+ order = scope(:find, :order) || 'id'
101
+ options = { :order => order, :page => 1 }.merge options
101
102
  options[:page] = options[:page].to_i
102
103
  options[:total_entries] = 0 # skip the individual count queries
103
104
  total = 0
@@ -160,7 +161,11 @@ module WillPaginate
160
161
  end
161
162
 
162
163
  protected
163
-
164
+
165
+ def respond_to_missing?(method, include_private = false)
166
+ method.to_s.index('paginate') == 0 || super
167
+ end
168
+
164
169
  def method_missing_with_paginate(method, *args) #:nodoc:
165
170
  # did somebody tried to paginate? if not, let them be
166
171
  unless method.to_s.index('paginate') == 0
@@ -2,7 +2,7 @@ module WillPaginate
2
2
  module VERSION
3
3
  MAJOR = 2
4
4
  MINOR = 3
5
- TINY = 16
5
+ TINY = 17
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/test/ci.rb CHANGED
@@ -45,6 +45,10 @@ gemfiles.each do |gemfile|
45
45
  next if 'mysql' == db and !run_mysql
46
46
  announce "Rails #{version}", "with #{db}"
47
47
  ENV['DB'] = db
48
+ if db == 'postgres' && !ENV['TRAVIS']
49
+ system "psql -c 'drop database will_paginate;' &>/dev/null"
50
+ system "psql -c 'create database will_paginate;' >/dev/null"
51
+ end
48
52
  failed = true unless system %(bundle exec rake)
49
53
  end
50
54
  else
@@ -12,5 +12,5 @@ mysql:
12
12
  postgres:
13
13
  adapter: postgresql
14
14
  database: will_paginate
15
- username: postgres
15
+ username:
16
16
  min_messages: warning
@@ -100,7 +100,7 @@ class FinderTest < ActiveRecordTestCase
100
100
  end
101
101
 
102
102
  def test_paginate_with_conditions
103
- entries = Topic.paginate :page => 1, :conditions => ["created_at > ?", 30.minutes.ago]
103
+ entries = Topic.paginate :page => 1, :conditions => ["created_at > ?", 30.minutes.ago], :order => :id
104
104
  expected = [topics(:rails), topics(:ar)]
105
105
  assert_equal expected, entries.to_a
106
106
  assert_equal 1, entries.total_pages
@@ -190,7 +190,7 @@ class FinderTest < ActiveRecordTestCase
190
190
  end
191
191
 
192
192
  def test_paginate_association_extension
193
- project = Project.find(:first)
193
+ project = Project.find(:first, :order => :id)
194
194
 
195
195
  assert_queries(2) do
196
196
  entries = project.replies.paginate_recent :page => 1
@@ -241,7 +241,7 @@ class FinderTest < ActiveRecordTestCase
241
241
  assert_equal entries, Developer.paginate_by_salary(100000, :page => 1, :per_page => 5)
242
242
 
243
243
  # dynamic finder + conditions
244
- entries = Developer.paginate_by_salary(100000, :page => 1,
244
+ entries = Developer.paginate_by_salary(100000, :page => 1, :order => :id,
245
245
  :conditions => ['id > ?', 6])
246
246
  assert_equal 4, entries.total_entries
247
247
  assert_equal (7..10).to_a, entries.map(&:id)
@@ -308,6 +308,13 @@ class FinderTest < ActiveRecordTestCase
308
308
  assert_equal 1, entries.size
309
309
  end
310
310
 
311
+ def test_paginated_each_with_scoped_order
312
+ paginated_developers = []
313
+ Developer.poor.paginated_each {|d| paginated_developers << d}
314
+
315
+ assert_equal Developer.poor.find(:all), paginated_developers, 'should use scoped :order option'
316
+ end
317
+
311
318
  ## misc ##
312
319
 
313
320
  def test_count_and_total_entries_options_are_mutually_exclusive
@@ -241,7 +241,14 @@ class ViewTest < WillPaginate::ViewTestCase
241
241
  paginate
242
242
  assert_links_match /foo%5Bbar%5D=baz/
243
243
  end
244
-
244
+
245
+ def test_will_paginate_prevents_host_and_protocol_tampering
246
+ @request.params :host => 'disney.com', :protocol => 'javascript'
247
+ paginate
248
+ assert_no_links_match /disney/
249
+ assert_no_links_match /javascript/
250
+ end
251
+
245
252
  def test_will_paginate_doesnt_preserve_parameters_on_post
246
253
  @request.post
247
254
  @request.params :foo => 'bar'
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: will_paginate
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 33
4
5
  prerelease:
5
- version: 2.3.16
6
+ segments:
7
+ - 2
8
+ - 3
9
+ - 17
10
+ version: 2.3.17
6
11
  platform: ruby
7
12
  authors:
8
13
  - "Mislav Marohni\xC4\x87"
@@ -11,7 +16,8 @@ autorequire:
11
16
  bindir: bin
12
17
  cert_chain: []
13
18
 
14
- date: 2011-08-09 00:00:00 Z
19
+ date: 2016-10-15 00:00:00 +02:00
20
+ default_executable:
15
21
  dependencies: []
16
22
 
17
23
  description: will_paginate provides a simple API for Active Record pagination and rendering of pagination links in Rails templates.
@@ -72,9 +78,10 @@ files:
72
78
  - README.md
73
79
  - LICENSE
74
80
  - CHANGELOG.rdoc
81
+ has_rdoc: true
75
82
  homepage: https://github.com/mislav/will_paginate/wiki
76
- licenses: []
77
-
83
+ licenses:
84
+ - MIT
78
85
  post_install_message:
79
86
  rdoc_options:
80
87
  - --main
@@ -87,17 +94,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
94
  requirements:
88
95
  - - ">="
89
96
  - !ruby/object:Gem::Version
97
+ hash: 3
98
+ segments:
99
+ - 0
90
100
  version: "0"
91
101
  required_rubygems_version: !ruby/object:Gem::Requirement
92
102
  none: false
93
103
  requirements:
94
104
  - - ">="
95
105
  - !ruby/object:Gem::Version
106
+ hash: 3
107
+ segments:
108
+ - 0
96
109
  version: "0"
97
110
  requirements: []
98
111
 
99
112
  rubyforge_project:
100
- rubygems_version: 1.8.5
113
+ rubygems_version: 1.6.2
101
114
  signing_key:
102
115
  specification_version: 3
103
116
  summary: Easy pagination for Rails