Sha256: ff9376db10ceea3ab22856a7ea8653cf0bb176b491dfe3c28283bbd7d71f5bff

Contents?: true

Size: 662 Bytes

Versions: 1

Compression:

Stored size: 662 Bytes

Contents

module Hive
  
  # Tracks community members.
  class Member < Base
    self.table_name = :hive_members
    self.primary_keys = %i(community account)
    
    has_many :communities, primary_key: :community, foreign_key: :name
    has_many :accounts, primary_key: :account, foreign_key: :name
    has_many :posts, through: :communities
    has_many :post_tags, through: :posts
    
    scope :admin, lambda { |admin = true| where(is_admin: admin) }
    scope :mod, lambda { |mod = true| where(is_mod: mod) }
    scope :approved, lambda { |approved = true| where(is_approved: approved) }
    scope :muted, lambda { |muted = true| where(is_muted: muted) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hivemind-ruby-0.1.0 lib/hive/models/member.rb