class User < ApplicationRecord
  include Dunlop::UserModel
  attr_accessor :my_domain # used for advanced authorization testing

  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, #:registerable, :trackable,
         :recoverable, :rememberable, :validatable

  scope :active, ->{ all }

  class << self
    def for_domain(domain)
      where.not(email: 'outside-domain@example.com')
    end
  end
end
