I am using Postgres 9.3 json data type. I want to do a query with data that is nested within the array.
For example, I want to query for users that have all of this interests = ["music", "movies", "programming"].
Thanks!
Example:
model User
data: {
"name": "johndoe1",
"github": "johndoe1",
"bio": "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Labore impedit aliquam sapiente dolore magni aliquid ipsa ad, enim, esse ut reprehenderit quaerat deleniti fugit eaque. Vero eligendi voluptatibus atque, asperiores.",
"blog": "http://johndoe1.example.com",
"interests": [
"music",
"movies",
"programming"
],
"age": 35,
"newsletter": true
}
User.where("data -> 'interests' = '[\"music\", \"movies\", \"programming\"]'")
not working.