Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

I need find movies with tags I have PostgeSQL array

   add_column :movies, :string_tags, :text, array:true,  default: []

And i have a array in html params

tags[]=test1&tags[]=test2

How i can connect them?

Movie.where("string_tags @> ?", params[:tags])

Not work

PG::Error: ERROR:  array value must start with "{" or dimension information
LINE 1: ...CT "movies".* FROM "movies" WHERE (string_tags @> 'test1','test2...

For example, Movie.where("string_tags @> ?", "{"+params[:test].join(",")+"}") work, I don't think this is a good solution

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.