Class: Slot
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Slot
- Defined in:
- app/models/slot.rb
Overview
This represents the abstract concept of a Slot, which can be specialized in FreeSlots or Bookings. A booking is drawn over a free slot in the UI.
Schema Information
Table name: slots
id :integer not null, primary key
capacity :integer default("1")
min_booking_length :integer default("15")
created_at :datetime not null
updated_at :datetime not null
slot_group_id :integer
color_id :integer not null
type :string not null
provider_id :integer
booking_state_id :integer
period_id :integer not null
affiliation_id :integer
free_slot_id :integer
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Slot) initialize
constructor
A new instance of Slot.
Constructor Details
- (Slot) initialize
Returns a new instance of Slot
37 38 39 40 |
# File 'app/models/slot.rb', line 37 def initialize(*) super self.period ||= build_period end |
Class Method Details
+ (Object) week(current_week)
42 43 44 45 46 47 48 |
# File 'app/models/slot.rb', line 42 def self.week(current_week) joins(:period).where( 'periods.starts_at > :beginning_of_week AND periods.ends_at < :end_of_week', beginning_of_week: current_week.beginning_of_week, end_of_week: current_week.end_of_week ) end |