I have this find condition pulling from my model that currently looks like this.
@major_set = Interest.find(:all, :conditions => {:id => 1..21})
I’d like to add some more individual ids that I’ve just added which are like 120…130. I tried to do…
@major_set = Interest.find(:all, :conditions => {:id => 1..21, 120..130})
but got the error. ” syntax error, unexpected ‘}’, expecting tASSOC …ns => {:id => 1..21, 122..130})”
How can I select multiple sets of id’s as well as maybe some individual ids, ie ( :conditions => {:id => 1..21, 121..140, 144, 155 }??
You can convert the ranges to arrays and add them together. E.g.
If you then want to add in individual ids then you can just add them to the array. E.g.