lundi 9 novembre 2015

Where query with Time.now

I want to achieve the following:

Model.where("asdasd = ? AND to <= ?", nil, Time.now).each do |model|

I get the following error:

ActiveRecord::StatementInvalid: SQLite3::SQLException: near "to": syntax error: SELECT "bla".* FROM "table" WHERE (asdasd = NULL AND to <= '2015-11-09 10:18:14.777643')

I also use the same in another controller, where I get the same error. What would be the correct way to achieve what I want? I am also quite sure that it worked already like that, could there be any other thing which causes this issue?

Thanks!!!

Aucun commentaire:

Enregistrer un commentaire