Sha256: 1509c024ca105f6f79fcc9d48d2738b5b79c6fee33b8974c82f5becf7df58fd2

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

module Camaraderie
  module User
    extend ActiveSupport::Concern

    included do
      # Associations
      has_many :memberships, dependent: :destroy
      has_many :organizations, through: :memberships

      Camaraderie.membership_types.each do |type|
        class_eval <<-RUBY, __FILE__, __LINE__ + 1
          def #{type}_of?(organization)
            !!memberships.admins.where(organization: organization).exists?
          end
        RUBY
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
camaraderie-0.1.2 lib/camaraderie/user.rb