Class: Affiliation

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/affiliation.rb

Overview

Ties Customers and service Providers together.

Schema Information

Table name: affiliations

id                   :integer          not null, primary key
provider_id          :integer          not null
customer_id          :integer          not null
created_at           :datetime         not null
updated_at           :datetime         not null
affiliation_state_id :integer          not null

Indexes

index_affiliations_on_provider_id_and_customer_id  (provider_id,customer_id) UNIQUE

Instance Method Summary (collapse)

Constructor Details

- (Affiliation) initialize

Returns a new instance of Affiliation



31
32
33
34
# File 'app/models/affiliation.rb', line 31

def initialize(*)
  super
  self.affiliation_state ||= AffiliationState.pending
end

Instance Method Details

- (Object) week_bookings(current_week)



36
37
38
# File 'app/models/affiliation.rb', line 36

def week_bookings(current_week)
  bookings.week(current_week)
end