Fix #3642: Issues with sequential pagination.
As of Rails 5, overriding `to_a` on an ActiveRecord collection does
nothing. We need to override `records` instead.
ref: cdd45fa09d
This commit is contained in:
@@ -19,7 +19,10 @@ module Danbooru
|
||||
end
|
||||
end
|
||||
|
||||
def to_a
|
||||
# XXX Hack: in sequential pagination we fetch one more record than we need
|
||||
# so that we can tell when we're on the first or last page. Here we override
|
||||
# a rails internal method to discard that extra record. See #2044, #3642.
|
||||
def records
|
||||
if sequential_paginator_mode == :before
|
||||
super.first(records_per_page)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user