Sha256: 353d9bdbe95f082e56d255606a9d42843997e35e422f4fead011b9bb2a727502
Contents?: true
Size: 622 Bytes
Versions: 2
Compression:
Stored size: 622 Bytes
Contents
module Camaraderie module Organization extend ActiveSupport::Concern included do # Associations has_many :memberships, dependent: :destroy has_many :users, through: :memberships # Define a method for each type of membership # # @example # user = User.new(email: 'foo@example.com') # Organization.first.admins.create(user: user) Camaraderie.membership_types.each do |type| class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{type.pluralize} memberships.#{type.pluralize} end RUBY end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
camaraderie-0.1.3 | lib/camaraderie/organization.rb |
camaraderie-0.1.2 | lib/camaraderie/organization.rb |