I have set enum task_status as:
class ConfirmedTask < ApplicationRecord
enum task_status: {pending: 1, complete: 2}
end
Now i have to search all task with pending status with search params 'pend'. I am using pg_search for search but it doesnot work with enum so i want to query using LIKE query:
ConfirmedTask.where('task_status like ?', '%pend%')
But this gives me error
ActiveRecord::StatementInvalid (PG::UndefinedFunction: ERROR: operator does not exist: integer ~~ unknown) LINE 1: ...asks".* FROM "confirmed_tasks" WHERE (task_status like '%pen... ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
any suggestions?