Class: Renalware::HD::Diary

Inherits:
ApplicationRecord show all
Includes:
Accountable
Defined in:
app/models/renalware/hd/diary.rb

Direct Known Subclasses

MasterDiary, WeeklyDiary

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Accountable

#first_or_create_by!, #save_by, #save_by!, #update_by

Class Method Details

.policy_classObject



27
28
29
# File 'app/models/renalware/hd/diary.rb', line 27

def self.policy_class
  DiaryPolicy
end

Instance Method Details

#slot_for(diurnal_period_code_id, station_id, day_of_week) ⇒ Object

Searchs the object graph rather than a SQL search



32
33
34
35
36
37
38
# File 'app/models/renalware/hd/diary.rb', line 32

def slot_for(diurnal_period_code_id, station_id, day_of_week)
  slots.find do |slot|
    slot.diurnal_period_code_id == diurnal_period_code_id &&
      slot.station_id == station_id &&
      slot.day_of_week == day_of_week
  end
end