activerecord find all NOT included in an array
I have an array of team names from another part of code and I want to find all the Teams not in that array. I've tried the following and it doesn't work.
@team_exclude_list = ['Team 1', 'Team 2', 'Team 3'] @teams = Team.where("name != ?", @team_exclude_list)
This is in Rails 3 and the Googles aren't giving me much love.
I've never done this with a string field, but perhaps this will work:
@teams = Team.where("name NOT IN (?)", @team_exclude_list)