I want to execute this query in rails app
Video.where("category= 'film' AND grant = 1").order('created_at DESC').page(params[:page]).per_page(10)
here grant stores an integer value.
and I am getting following error
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
thanks in advance