Sha256: 9f4c8f2b936e5d423e8771f49dbb4f81d10b3b83df858e5e5043e212f6106070

Contents?: true

Size: 531 Bytes

Versions: 1

Compression:

Stored size: 531 Bytes

Contents

# frozen_string_literal: true

require "models/job"

class User < ActiveRecord::Base
  has_secure_token
  has_secure_token :auth_token

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

  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

1 entries across 1 versions & 1 rubygems

Version Path
ruby-on-quails-0.1.0 activerecord/test/models/user.rb