ruby on rails - activerecord find all NOT included in an array -


i have array of team names part of code , want find teams not in array. i've tried following , doesn't work.

@team_exclude_list = ['team 1', 'team 2', 'team 3'] @teams = team.where("name != ?", @team_exclude_list) 

this in rails 3 , googles aren't giving me love.

i've never done string field, perhaps work:

@teams = team.where("name not in (?)", @team_exclude_list) 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -