Skip to content

Commit 6c52696

Browse files
committed
Total count header plays nice with Rack Webrick Handler
1 parent 464e2e0 commit 6c52696

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/rails/pagination.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _paginate_collection(collection, options={})
4646
headers['Link'] = links.join(', ') unless links.empty?
4747
headers[per_page_header] = options[:per_page].to_s
4848
headers[page_header] = options[:page].to_s unless page_header.nil?
49-
headers[total_header] = total_count(collection, options) if include_total
49+
headers[total_header] = total_count(collection, options).to_s if include_total
5050

5151
return collection
5252
end

spec/rails_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@
212212

213213
specify do
214214
get :index_with_paginate_array_options, params: params
215+
216+
expect(response.header['Total']).to be_kind_of(String)
215217
expect(response.header['Total'].to_i).to eq total_header
216218
end
217219
end

0 commit comments

Comments
 (0)