Sha256: b5f11c447ea7adbbf2512e343e31da62b93515e144c7688e24a0b8e4679bb366
Contents?: true
Size: 938 Bytes
Versions: 9
Compression:
Stored size: 938 Bytes
Contents
module Jobshop class Team < ApplicationRecord belongs_to :owner, class_name: "Jobshop::User", optional: true has_many :users, class_name: "Jobshop::User" has_one :default_dashboard, class_name: "Jobshop::Dashboard" scope :grouped_by_email, ->(email_addresses) { Jobshop::User .where(email: email_addresses) .joins(:team) .includes(:team) .each_with_object({}) { |user, teams| (teams[user.email] ||= []) << user.team } } def generate_registration_token raw, encrypted = Devise.token_generator.generate( self.class, :registration_token) self.registration_token = encrypted self.registration_token_sent_at = Time.now.utc self.save(validate: false) raw end def registration_token_period_valid? registration_token_sent_at && registration_token_sent_at.utc >= 30.minutes.ago.utc end end end
Version data entries
9 entries across 9 versions & 1 rubygems