0
"終了"フィールドがTime.nowより小さい場合、予約の@レーティングを表示しようとしています。ActiveRecordクエリにインクルードと制限の日付を使用
これは(ただし、時間制限なし)作品:
@ratings = Rating.where(user_id: current_user.id).includes(:reservation).includes(:room)
私はこのように、 "reservations.end < Time.now" でクエリを制限しようとしています:
@ratings = Rating.where(user_id: current_user.id, reservations.end < Time.now).includes(:reservation).includes(:room)
それは動作しません。