0
這裏是我的檢查布爾碼(我使用SQLite)軌道模型,其中布爾值
Swimming::Classstudent.where("swimming_classtimes.date >= ? and student_id = ? and deleted = 'f'",current_date,student_id)
顯然,這看起來很難看。
我試圖
Swimming::Classstudent.where("swimming_classtimes.date >= ? and student_id = ? and deleted = 0 ",current_date,student_id)
和
Swimming::Classstudent.where("swimming_classtimes.date >= ? and student_id = ? and deleted = false ",current_date,student_id)
他們都沒有工作。有沒有更好的方法來檢查軌道中的where
布爾值?
試試這個的: 游泳:: Classstudent.where(「swimming_classtimes.date> =? Swimming_classtimes.date> =?和student_id =?並刪除=?「,current_date()和student_id =?」,current_date,student_id)。其中(:deleted => false) 或此: Swimming :: Classstudent.where ,student_id,false) –
@Taiki我試過第二個它的作品! – wwli