Class: CommonEngine::Schedule

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/common_engine/schedule.rb

Instance Method Summary collapse

Instance Method Details

#set_category_textObject



16
17
18
19
# File 'app/models/common_engine/schedule.rb', line 16

def set_category_text
  self.category_text = I18n.t('activerecord.schedules.categories.' + self.category.to_s)
  return self
end

#set_titleObject



20
21
22
23
24
25
26
27
28
29
30
# File 'app/models/common_engine/schedule.rb', line 20

def set_title
  self.set_category_text
  if self.chapter.present? && self.chapter.course.present?
    self.title = self.category_text + "\n" + self.chapter.course.name + "\n" + self.chapter.name
  elsif self.event.present?
    self.title = self.category_text + "\n" + self.event.name
  else
    self.title = self.category_text
  end
  return self
end