fix User.potential_team_members

This commit is contained in:
Dmitriy Zaporozhets 2013-01-25 15:36:10 +02:00
parent 8016a7bd33
commit 70e05801b1

View file

@ -91,7 +91,7 @@ class User < ActiveRecord::Base
scope :alphabetically, order('name ASC') scope :alphabetically, order('name ASC')
scope :in_team, ->(team){ where(id: team.member_ids) } scope :in_team, ->(team){ where(id: team.member_ids) }
scope :not_in_team, ->(team){ where('users.id NOT IN (:ids)', ids: team.member_ids) } scope :not_in_team, ->(team){ where('users.id NOT IN (:ids)', ids: team.member_ids) }
scope :potential_team_members, ->(team) { team.members.any? ? active : active.not_in_team(team) } scope :potential_team_members, ->(team) { team.members.any? ? active.not_in_team(team) : active }
# #
# Class methods # Class methods