Reputation: 2952
I essentially want to perform a LIKE query on a PostgreSQL primary id column for a query generated using Squeel and I don't think Squeel is understanding the syntax I'm giving it. Any ideas?
Task.where("(id::text LIKE ?)", "%1%").to_sql
=> "SELECT \"tasks\".* FROM \"tasks\" WHERE ((id::text LIKE '%1%'))"
Task.where{(id::text =~ "%#{criteria}%")}.to_sql
=> "SELECT \"tasks\".* FROM \"tasks\" WHERE \"id\".\"text\" ILIKE '%criteria%'"
Upvotes: 0
Views: 55