我想在執行這個查詢Rails應用程序查詢在紅寶石檢查整數值在軌道上
Video.where("category= 'film' AND grant = 1").order('created_at DESC').page(params[:page]).per_page(10)
這裏授予店的整數值。
和我收到以下錯誤
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'grant = 1) ORDER BY created_at DESC LIMIT 10 OFFSET 0' at line 1: SELECT `videos`.* FROM `videos` WHERE (category= 'film' AND grant = 1) ORDER BY created_at DESC LIMIT 10 OFFSET 0
在此先感謝
更多的Rails-ish實現將使用'where(category:「film」,grant:1)' – thomasfedb
如果我們想使用OR而不是AND,該怎麼辦? – rohith