ruby on rails - Fetch all rows that column_id is in the array of id's, then order by id -
i trying this, not sure if doing correctly:
user.where("region_id => ?", region_ids).order("id asc") region_ids = [1234,234322,234324,2343,....] also, work if region_ids empty (not null, empty)
i seeing error:
check manual corresponds mysql server version right syntax use near '=> null) order id asc' @ line 1: when in debugger mode, output region_ids , [].
you're mixing ruby , sql syntax within string. want more ("region_id in (?)", region_ids) or ({ "region_id" => region_ids }).
Comments
Post a Comment