Class: NextSgad::EmployeeMessage

Inherits:
ApplicationRecord show all
Defined in:
app/models/next_sgad/employee_message.rb

Instance Method Summary collapse

Methods inherited from ApplicationRecord

#create_number, #create_number!

Instance Method Details

#mark_as_read(curr_employee = nil) ⇒ Object

marks a message as read and saves the date the message was read



17
18
19
20
21
# File 'app/models/next_sgad/employee_message.rb', line 17

def mark_as_read(curr_employee = nil)
  return false unless curr_employee.class.name.eql?(NextSgad::Employee.name)
  return false if read?
  self.update(status: :read, read_at: DateTime.now)
end