Rails activerecord LIKE AND clause error

activerecord, ruby-on-rails

Solution

You missed `LIKE` for `city`.

Model.where('city LIKE ? AND name LIKE ?', "%#{q}%", "%#{b}%");

Problem

Here is an activerecord query i'm trying to use in rails ``` q = "Manchester" b = "John Smith" Model.find(:all, :conditions => ["city ? AND name like ?", q, b]) ``` but i get this error in rails console ActiveRecord::StatementInvalid: SQLite3::SQLException: near "'Manchester'": syntax error: SELECT "model".* FROM "model" WHERE (city 'Manchester' AND name like 'John Smith') Please help!

Original source

Related problems