Sha256: f349a842926fb3608bdf4a8894a6247ee2f79a4ac1647c50a4b9e5f5276d1865

Contents?: true

Size: 525 Bytes

Versions: 1

Compression:

Stored size: 525 Bytes

Contents

module Kiqr
  module Models
    module Account
      extend ActiveSupport::Concern
      include PublicUid::ModelConcern

      included do
        has_many :members, dependent: :destroy
        has_many :users, through: :members
        has_many :pending_invitations, -> { pending }, class_name: "Member"

        validates :name, presence: true, length: { minimum: 3, maximum: 255 }
      end

      def has_member?(user)
        users.include? user
      end

      def team?
        !personal
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kiqr-0.1.0.alpha1 lib/kiqr/models/account.rb