Files
fizzy/app/models/user.rb
T
2025-11-17 09:12:40 -05:00

27 lines
747 B
Ruby

class User < ApplicationRecord
include Accessor, Assignee, Attachable, Configurable,
Mentionable, Named, Notifiable, Role, Searcher, Watcher
include Timelined # Depends on Accessor
has_one_attached :avatar
belongs_to :account
belongs_to :identity, optional: true
has_many :comments, inverse_of: :creator, dependent: :destroy
has_many :filters, foreign_key: :creator_id, inverse_of: :creator, dependent: :destroy
has_many :closures, dependent: :nullify
has_many :pins, dependent: :destroy
has_many :pinned_cards, through: :pins, source: :card
delegate :staff?, to: :identity, allow_nil: true
def deactivate
transaction do
accesses.destroy_all
update! active: false, identity: nil
end
end
end