Sha256: a5e4e6d3349f57de4ba2450fefdb2c9ed655cad62bcc1fadb88ce15d2fa4f14d

Contents?: true

Size: 626 Bytes

Versions: 5

Compression:

Stored size: 626 Bytes

Contents

# frozen_string_literal: true

require "models/job"

class User < ActiveRecord::Base
  has_secure_token
  has_secure_token :auth_token, length: 36

  has_and_belongs_to_many :jobs_pool,
    class_name: "Job",
    join_table: "jobs_pool"

  has_one :room
  has_one :owned_room, class_name: "Room", foreign_key: "owner_id"
  has_one :family_tree, -> { where(token: nil) }, foreign_key: "member_id"
  has_one :family, through: :family_tree
  has_many :family_members, through: :family, source: :members
end

class UserWithNotification < User
  after_create -> { Notification.create! message: "A new user has been created." }
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ibm_db-5.5.0 test/models/user.rb
ibm_db-5.4.1 test/models/user.rb
ibm_db-5.4.0 test/models/user.rb
ibm_db-5.3.2 test/models/user.rb
ibm_db-5.3.1 test/models/user.rb