A platform for community discussion. Free, open, simple.
DEV: Add new user scopes (#17026)
Blake Erickson27d7b0c6de73
diff --git a/app/models/user.rb b/app/models/user.rbindex d2e3323f3fb..92ae57dd0a9 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -220,6 +220,8 @@ class User < ActiveRecord::Basescope :suspended, -> { where('suspended_till IS NOT NULL AND suspended_till > ?', Time.zone.now) }scope :not_suspended, -> { where('suspended_till IS NULL OR suspended_till <= ?', Time.zone.now) }scope :activated, -> { where(active: true) }+ scope :not_staged, -> { where(staged: false) }+ scope :activated_not_suspended_not_staged, -> { self.activated.not_suspended.not_staged }scope :filter_by_username, ->(filter) doif filter.is_a?(Array)