Class: Lecturer
- Defined in:
- lib/tmis/engine/models/lecturer.rb
Overview
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Instance Method Summary collapse
- #set_stubs_for_studies ⇒ Object
-
#to_s ⇒ Object
Contract None => String.
Instance Method Details
#set_stubs_for_studies ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/tmis/engine/models/lecturer.rb', line 37 def set_stubs_for_studies raise "Stub can't be destroyed!" if self.stub stub = Lecturer.where(stub: true).first studies.each do |s| s.lecturer = stub s.save end end |
#to_s ⇒ Object
Contract None => String
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/tmis/engine/models/lecturer.rb', line 14 def to_s first = surname if name.nil? second = "" else if name.empty? second = name else second = name[0].mb_chars.capitalize.to_s end end if patronymic.nil? third = "" else if patronymic.empty? third = name else third = patronymic[0].mb_chars.capitalize.to_s end end "#{surname} #{second}.#{third}." end |