Remove simple code duplication in members controllers

This commit is contained in:
Andrey Kumanyaev 2013-01-24 22:31:28 +04:00 committed by Dmitriy Zaporozhets
parent e52fec9cd9
commit d839f6c525
3 changed files with 3 additions and 4 deletions

View file

@ -91,6 +91,7 @@ class User < ActiveRecord::Base
scope :alphabetically, order('name ASC')
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 :potential_team_members, ->(team) { team.members.any? ? active : active.not_in_team(team) }
#
# Class methods