I have a Track model with 4 columns of comma separated string values that need to be searchable by any number of terms.
e.g.
Track.first.genre => "Alternative, Lite Rock, Indie Rock, Psychedelic"
Track.first.mood => "Aggressive, Angry, Dark, Driving, Energetic, Heavy"
Track.first.tempo => "Fast, Medium"
Track.first.artist => "something"
A user then can use any number of terms to narrow down the list of displayed Tracks. I am collecting the terms into arrays matching each column. e.g.
genres = params[:genre].split(",")
moods = params[:mood].split(",")
and so on. So if genres => ["Rock", "Alternative"], that would match all Tracks which contain either of those terms in the genre column, and all additional terms would select from that returned array, and so on for each of the 4 columns.
What is the best way to do this, and how do I write a where query using like with an array as the condition?