I have a class User that has an hstore attribute :preferences. If I want to find all Users where the startpage key in their preferences is nil I can do:
User.where("preferences @> 'startpage=>NULL'")
How can I structure that query so it avoids SQL query injection?
Tried:
User.where("preferences @> :key '=>NULL'", key: 'startpage')
User.where("preferences @> :key IS 'NULL'", key: 'startpage')
User.where("preferences @> :key IS NULL", key: 'startpage')
User.where("preferences @> ? IS NULL", 'startpage')
Without luck. Anyone know how to do this?