Reputation: 4176
I have a User
table in postgres
. In rails console I search for User.where(<myWhereClause>).count
I have jsonb
column called as "criteria".
Within criteria
for key eligibility
, I want to see if the value contains my search term 'directMBA'
eligibility
is a comma separated string - 'directMBA, correspondanceMBA, onlineMBA'
This doesn't work
User.where("criteria->>'eligibility'.include?('directMBA')").count
I don't want the sql query. I need the Ruby Rails code to run in console
PS: Also, what if my keyword is 'directMBA' or 'onlineMBA'
Upvotes: 0
Views: 355