mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-31 13:49:06 +01:00
10 lines
313 B
Ruby
10 lines
313 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PaginatesAnswers
|
|
def paginate_answers
|
|
@answers = yield(last_id: params[:last_id])
|
|
answer_ids = @answers.map(&:id)
|
|
@answers_last_id = answer_ids.min
|
|
@more_data_available = !yield(last_id: @answers_last_id, size: 1).select("answers.id").count.zero?
|
|
end
|
|
end
|