Anyone have an idea on how you search arrays stored in ActiveRecord models?


#1

I posted a question and details on S/O


#2

If I use one text column to store multiple string values
I will store it as comma separated string
assuming those value will never contain comma

Then a “contain” query can be implemented using “like”

But I am not sure how you store the array yet


#3

its stored as a string


#4

What’s the format?
comma separated?


#5

You could use LIKE, but I think SO already gave you that answer. Depending on the database, you could have other options; Postgresql, for example, has built in text indexing that you could use. You could extract the individual array values and store them in another table.