Rails 4 solution:
@team_exclude_list = ['Team 1', 'Team 2', 'Team 3']
@teams = Team.where.not(name: @team_exclude_list)
Also, to speed up the query, you can:
- create an index on name
OR
- change the query to use IDs which are indexed by default
Rails 4 solution:
@team_exclude_list = ['Team 1', 'Team 2', 'Team 3']
@teams = Team.where.not(name: @team_exclude_list)
Also, to speed up the query, you can:
OR