Kaminari宝石因以下分页而无法分页 从控制器,我试图调用以下范围。 @ students.expired
scope :expired, -> { joins("LEFT JOIN (select MAX(expires_on) AS expires_on, student_id FROM subscriptions GROUP BY student_id) AS current_subscription ON current_subscription.student_id = role_students.id")
.where{ ((current_subscription.expires_on < Date.today)) | ((trial_ended_on < Date.current) & (current_subscription.expires_on == nil)) } }
它抛出以下错误:
Mysql2 :: Error:“ where”中的未知列“ student_schools.school_id” 子句”:选择count(*)作为subquery_count