i have postgres database table has field holds text array (the definition text[]). want search field rails array. example:
the table have 2 records:
record 1: id=>1, equip_numbers=>{885, 887, 900}
record 2: id=>2, equip_numbers=>{678, 789, 890}
record 3: id=>3, equip_numbers=>{885, 887}
array program be: equips = [885, 887, 900]
i want search table find record includes numbers equipment table above (so record 1 not record 2 or 3).
i have read using or single value searches (equipment.where("'885' = (equip_numbers)")). want like:
equipment.where("#{equips} in (equip_numbers))
but doesn't work. how use equips array search equip_numbers field in equipment table?
Comments
Post a Comment