Started GET “/forest/Quiz/count?fields%5BQuiz%5D=created_at%2Cid%2Cslug%2Ctitle%2Cupdated_at%2Cword%2Cwp_post%2Clevel%2Cauthor%2Clast_shared%2Caverage_score%2Cquiz_scores_count%2Cpremium%2Cquiz_category%2Csponsored_campaign%2Ctag_id%2Cfeatured&fields%5Bword%5D=id&fields%5Bwp_post%5D=id&fields%5Bauthor%5D=name&fields%5Bquiz_category%5D=name&fields%5Bsponsored_campaign%5D=id&timezone=Europe%2FBerlin” for 162.158.172.66 at 2025-06-16 13:17:07 +0200
production.log — I, [2025-06-16T13:17:07.637204 #944961] INFO – : [e7e8b57f-7cef-4eca-9f80-1b41ba8a6c03] Processing by ForestLiana::UserSpace::QuizController#count as JSON
production.log — I, [2025-06-16T13:17:07.637286 #944961] INFO – : [e7e8b57f-7cef-4eca-9f80-1b41ba8a6c03] Parameters: {“fields” => {“Quiz” => “created_at,id,slug,title,updated_at,word,wp_post,level,author,last_shared,average_score,quiz_scores_count,premium,quiz_category,sponsored_campaign,tag_id,featured”, “word” => “id”, “wp_post” => “id”, “author” => “name”, “quiz_category” => “name”, “sponsored_campaign” => “id”}, “timezone” => “Europe/Berlin”, “collection” => “Quiz”}
Customization of Quiz:
No customization of this collection.
Quiz model:
class Quiz < ApplicationRecord
validates_uniqueness_of :slug
belongs_to :wp_post, optional: true
belongs_to :quiz_category, optional: true
belongs_to :word, optional: true
belongs_to :author, optional: true
has_many :quiz_questions, :dependent => :destroy
has_many :quiz_scores, :dependent => :destroy
has_one :sponsored_campaign, :dependent => :destroy
def to_param
slug
end
def next
if quiz_category.present?
Quiz.where(quiz_category_id: quiz_category.id).where("id > ?", id).order("id ASC").first || Quiz.first
else
Quiz.where("id > ?", id).order("id ASC").first || Quiz.first
end
end
def previous
if quiz_category.present?
Quiz.where(quiz_category_id: quiz_category.id).where("id < ?", id).order("id DESC").first || Quiz.last
else
Quiz.where("id < ?", id).order("id DESC").first || Quiz.last
end
end
end