Why is Model.scoped generating invalid SQL?

Posted by Nicholas H. on Stack Overflow See other posts from Stack Overflow or by Nicholas H.
Published on 2010-05-18T22:18:59Z Indexed on 2010/05/19 8:30 UTC
Read the original article Hit count: 199

Filed under:
|

When I run Book.scoped({:conditions => ['books.index LIKE ?','%query%']}) I get:

ActiveRecord::StatementInvalid: SQLite3::SQLException: near "index": syntax error: SELECT * FROM "books" WHERE (books.index like '%query%')

What am I doing wrong?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about activerecord