mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 14:39:52 +01:00
18 lines
594 B
Ruby
18 lines
594 B
Ruby
# frozen_string_literal: true
|
|
|
|
class QuestionController < ApplicationController
|
|
include PaginatesAnswers
|
|
|
|
def show
|
|
@question = Question.find(params[:id])
|
|
@answers = @question.cursored_answers(last_id: params[:last_id], current_user:)
|
|
answer_ids = @answers.map(&:id)
|
|
@answers_last_id = answer_ids.min
|
|
@more_data_available = !@question.cursored_answers(last_id: @answers_last_id, size: 1, current_user:).select("answers.id").count.zero?
|
|
|
|
respond_to do |format|
|
|
format.html
|
|
format.turbo_stream { render layout: false, status: :see_other }
|
|
end
|
|
end
|
|
end
|