Wednesday, July 15, 2026 4:00:20 AM
> community_default.rb
# frozen_string_literal: true

module ESM
  class CommunityDefault < ApplicationRecord
    # =============================================================================
    # INITIALIZE
    # =============================================================================

    # =============================================================================
    # DATA STRUCTURE
    # =============================================================================

    attribute :community_id, :integer
    attribute :server_id, :integer
    attribute :channel_id, :string
    attribute :created_at, :datetime
    attribute :updated_at, :datetime

    # =============================================================================
    # ASSOCIATIONS
    # =============================================================================

    belongs_to :community
    belongs_to :server

    # =============================================================================
    # VALIDATIONS
    # =============================================================================

    # =============================================================================
    # CALLBACKS
    # =============================================================================

    # =============================================================================
    # SCOPES
    # =============================================================================

    # =============================================================================
    # CLASS METHODS
    # =============================================================================

    def self.global
      where(channel_id: nil).first
    end

    def self.for_channel(channel)
      where(channel_id: channel.id.to_s).first
    end

    # =============================================================================
    # INSTANCE METHODS
    # =============================================================================
  end
end
All opinions represented herein are my own
- © 2024 - 2026 itsthedevman
- build 43aa0d7