Sha256: c10248fddb5435ef8fd509be2d9ed241126a7b3bb61e44910d4323194577bfe4

Contents?: true

Size: 467 Bytes

Versions: 15

Compression:

Stored size: 467 Bytes

Contents

class Membership < ActiveRecord::Base
  self.primary_keys = :user_id, :group_id
  belongs_to :user
	belongs_to :group
	has_many :statuses, :class_name => 'MembershipStatus', :foreign_key => [:user_id, :group_id]
  has_many :active_statuses, -> { where('membership_statuses.status = ?', 'Active') },
           :class_name => 'MembershipStatus', :foreign_key => [:user_id, :group_id]
  has_many :readings, :primary_key => :user_id, :foreign_key => :user_id
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
composite_primary_keys-14.0.9 test/fixtures/membership.rb
composite_primary_keys-14.0.8 test/fixtures/membership.rb
composite_primary_keys-13.0.8 test/fixtures/membership.rb
composite_primary_keys-14.0.7 test/fixtures/membership.rb
composite_primary_keys-14.0.6 test/fixtures/membership.rb
composite_primary_keys-13.0.7 test/fixtures/membership.rb
composite_primary_keys-13.0.6 test/fixtures/membership.rb
composite_primary_keys-14.0.5 test/fixtures/membership.rb
composite_primary_keys-13.0.5 test/fixtures/membership.rb
composite_primary_keys-13.0.4 test/fixtures/membership.rb
composite_primary_keys-14.0.4 test/fixtures/membership.rb
composite_primary_keys-14.0.3 test/fixtures/membership.rb
composite_primary_keys-13.0.3 test/fixtures/membership.rb
composite_primary_keys-14.0.2 test/fixtures/membership.rb
composite_primary_keys-13.0.2 test/fixtures/membership.rb