will_paginate 3.1.0 → 3.1.1
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/README.md +1 -1
- data/lib/will_paginate/active_record.rb +2 -2
- data/lib/will_paginate/version.rb +1 -1
- data/lib/will_paginate/view_helpers/action_view.rb +3 -1
- data/lib/will_paginate/view_helpers/link_renderer.rb +3 -2
- data/spec/database.yml +11 -7
- data/spec/view_helpers/action_view_spec.rb +9 -2
- data/spec/view_helpers/view_example_group.rb +1 -1
- 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: 37738a4f9afbe87bcb4061f1e0336498f38ddf49
|
4
|
+
data.tar.gz: 61784364ffb2e3fc1719b85fe0e7ee8f92de8a9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfc4458d9ab67b9d059c5028d8346d28be729bc85c81df5b5d4a23e34f71075ea5ca9a3ccc98950ee82302413101fb3b259ed5f4180e43e4f5952fd0286c05e0
|
7
|
+
data.tar.gz: b4efefc99c7aff85f172eead0b2356f90eab50c4502002425bb198abb187c0ed833aa3dd1f7da36a8dd0a6bf4cf2a62d5339f090ea5f7ad20a198c14ea71a731
|
data/README.md
CHANGED
@@ -99,6 +99,8 @@ module WillPaginate
|
|
99
99
|
class LinkRenderer < ViewHelpers::LinkRenderer
|
100
100
|
protected
|
101
101
|
|
102
|
+
GET_PARAMS_BLACKLIST = [:script_name]
|
103
|
+
|
102
104
|
def default_url_params
|
103
105
|
{}
|
104
106
|
end
|
@@ -118,7 +120,7 @@ module WillPaginate
|
|
118
120
|
|
119
121
|
def merge_get_params(url_params)
|
120
122
|
if @template.respond_to? :request and @template.request and @template.request.get?
|
121
|
-
symbolized_update(url_params, @template.params)
|
123
|
+
symbolized_update(url_params, @template.params, GET_PARAMS_BLACKLIST)
|
122
124
|
end
|
123
125
|
url_params
|
124
126
|
end
|
@@ -114,11 +114,12 @@ module WillPaginate
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
def symbolized_update(target, other)
|
117
|
+
def symbolized_update(target, other, blacklist = nil)
|
118
118
|
other.each do |key, value|
|
119
119
|
key = key.to_sym
|
120
120
|
existing = target[key]
|
121
|
-
|
121
|
+
next if blacklist && blacklist.include?(key)
|
122
|
+
|
122
123
|
if value.is_a?(Hash) and (existing.is_a?(Hash) or existing.nil?)
|
123
124
|
symbolized_update(existing || (target[key] = {}), value)
|
124
125
|
else
|
data/spec/database.yml
CHANGED
@@ -3,23 +3,27 @@ sqlite3:
|
|
3
3
|
adapter: sqlite3
|
4
4
|
timeout: 500
|
5
5
|
|
6
|
-
mysql:
|
6
|
+
mysql: &mysql
|
7
7
|
adapter: mysql
|
8
8
|
database: will_paginate
|
9
9
|
username:
|
10
10
|
encoding: utf8
|
11
|
-
|
11
|
+
<% if File.exist?("/var/run/mysql5/mysqld.sock") %>
|
12
|
+
host: localhost
|
13
|
+
socket: /var/run/mysql5/mysqld.sock
|
14
|
+
<% elsif File.exist? "/tmp/mysql.sock" %>
|
15
|
+
host: localhost
|
16
|
+
socket: /tmp/mysql.sock
|
17
|
+
<% else %>
|
18
|
+
host: 127.0.0.1
|
19
|
+
<% end %>
|
12
20
|
|
13
21
|
mysql2:
|
22
|
+
<<: *mysql
|
14
23
|
adapter: mysql2
|
15
|
-
database: will_paginate
|
16
|
-
username:
|
17
|
-
encoding: utf8
|
18
|
-
socket: <%= ENV["BOXEN_MYSQL_SOCKET"] %>
|
19
24
|
|
20
25
|
postgres:
|
21
26
|
adapter: postgresql
|
22
27
|
database: will_paginate
|
23
28
|
username: <%= "postgres" if ENV["TRAVIS"] %>
|
24
29
|
min_messages: warning
|
25
|
-
port: <%= ENV["BOXEN_POSTGRESQL_PORT"] %>
|
@@ -201,6 +201,13 @@ describe WillPaginate::ActionView do
|
|
201
201
|
assert_no_links_match /99/
|
202
202
|
assert_no_links_match /ftp/
|
203
203
|
end
|
204
|
+
|
205
|
+
it "doesn't allow tampering with script_name" do
|
206
|
+
request.params :script_name => 'p0wned'
|
207
|
+
paginate
|
208
|
+
assert_links_match %r{^/foo/bar}
|
209
|
+
assert_no_links_match /p0wned/
|
210
|
+
end
|
204
211
|
|
205
212
|
it "should not preserve parameters on POST" do
|
206
213
|
request.post
|
@@ -250,7 +257,7 @@ describe WillPaginate::ActionView do
|
|
250
257
|
end
|
251
258
|
|
252
259
|
it "should paginate with custom route page parameter" do
|
253
|
-
request.symbolized_path_parameters.update :controller => 'dummy', :action =>
|
260
|
+
request.symbolized_path_parameters.update :controller => 'dummy', :action => 'index'
|
254
261
|
paginate :per_page => 2 do
|
255
262
|
assert_select 'a[href]', 6 do |links|
|
256
263
|
assert_links_match %r{/page/(\d+)$}, links, [2, 3, 4, 5, 6, 2]
|
@@ -268,7 +275,7 @@ describe WillPaginate::ActionView do
|
|
268
275
|
end
|
269
276
|
|
270
277
|
it "should paginate with custom route and first page number implicit" do
|
271
|
-
request.symbolized_path_parameters.update :controller => 'ibocorp', :action =>
|
278
|
+
request.symbolized_path_parameters.update :controller => 'ibocorp', :action => 'index'
|
272
279
|
paginate :page => 2, :per_page => 2 do
|
273
280
|
assert_select 'a[href]', 7 do |links|
|
274
281
|
assert_links_match %r{/ibocorp(?:/(\d+))?$}, links, [nil, nil, 3, 4, 5, 6, 3]
|
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.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mislav Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-20 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
|