Class: Stay::Message
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Stay::Message
- Defined in:
- app/models/stay/message.rb
Instance Method Summary collapse
- #attachments_urls ⇒ Object
- #host_messages ⇒ Object
- #read? ⇒ Boolean
- #set_default_event_for ⇒ Object
- #student_messages ⇒ Object
Instance Method Details
#attachments_urls ⇒ Object
22 23 24 |
# File 'app/models/stay/message.rb', line 22 def .map { |image| image.url } end |
#host_messages ⇒ Object
14 15 16 |
# File 'app/models/stay/message.rb', line 14 def where(event_for: [ "host", "both" ]) end |
#read? ⇒ Boolean
10 11 12 |
# File 'app/models/stay/message.rb', line 10 def read? read_at.present? end |
#set_default_event_for ⇒ Object
26 27 28 |
# File 'app/models/stay/message.rb', line 26 def set_default_event_for self.event_for ||= :both end |
#student_messages ⇒ Object
18 19 20 |
# File 'app/models/stay/message.rb', line 18 def where(event_for: [ "student", "both" ]) end |