summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 5b0df09a439..8c1a8b42b67 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -87,10 +87,10 @@ class User < ActiveRecord::Base
delegate :path, to: :namespace, allow_nil: true, prefix: true
# Scopes
- scope :admins, where(admin: true)
- scope :blocked, where(blocked: true)
- scope :active, where(blocked: false)
- scope :alphabetically, order('name ASC')
+ scope :admins, -> { where(admin: true) }
+ scope :blocked, -> { where(blocked: true) }
+ scope :active, -> { where(blocked: false) }
+ 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.not_in_team(team) : active }