Sha256: 9f648d7496f6c80a51789ed065f5403656918cdf364f58e175273b23c6dd1217

Contents?: true

Size: 426 Bytes

Versions: 16

Compression:

Stored size: 426 Bytes

Contents

module Dorsale::Users::Active
  def self.included(user_model)
    user_model.class_eval do
      validates :is_active, inclusion: {in: [true, false]}

      def initialize(*)
        super
        self.is_active = true if is_active.nil?
      end

      def active_for_authentication?
        super && self.is_active?
      end

      def inactive_message
        I18n.t("messages.users.inactive")
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dorsale-3.7.8 app/models/dorsale/users/active.rb
dorsale-3.7.7 app/models/dorsale/users/active.rb
dorsale-3.7.6 app/models/dorsale/users/active.rb
dorsale-3.7.5 app/models/dorsale/users/active.rb
dorsale-3.7.4 app/models/dorsale/users/active.rb
dorsale-3.7.2 app/models/dorsale/users/active.rb
dorsale-3.7.1 app/models/dorsale/users/active.rb
dorsale-3.7.0 app/models/dorsale/users/active.rb
dorsale-3.6.1 app/models/dorsale/users/active.rb
dorsale-3.6.0 app/models/dorsale/users/active.rb
dorsale-3.5.2 app/models/dorsale/users/active.rb
dorsale-3.5.1 app/models/dorsale/users/active.rb
dorsale-3.5.0 app/models/dorsale/users/active.rb
dorsale-3.4.0 app/models/dorsale/users/active.rb
dorsale-3.3.0 app/models/dorsale/users/active.rb
dorsale-3.2.0 app/models/dorsale/users/active.rb