Class: Stay::Message

Inherits:
ApplicationRecord show all
Defined in:
app/models/stay/message.rb

Instance Method Summary collapse

Instance Method Details

#attachments_urlsObject



22
23
24
# File 'app/models/stay/message.rb', line 22

def attachments_urls
  attachments.map { |image| image.url }
end

#host_messagesObject



14
15
16
# File 'app/models/stay/message.rb', line 14

def host_messages
  where(event_for: [ "host", "both" ])
end

#read?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/models/stay/message.rb', line 10

def read?
  read_at.present?
end

#set_default_event_forObject



26
27
28
# File 'app/models/stay/message.rb', line 26

def set_default_event_for
  self.event_for ||= :both
end

#student_messagesObject



18
19
20
# File 'app/models/stay/message.rb', line 18

def student_messages
  where(event_for: [ "student", "both" ])
end