Class: Messaged::Message

Inherits:
ApplicationRecord show all
Includes:
ActionView::RecordIdentifier
Defined in:
app/models/messaged/message.rb

Instance Method Summary collapse

Instance Method Details

#ownerObject

Messages should default to the person sending them, otherwise fallback to the chat room, and finally tenant if they exist.



28
29
30
31
32
33
# File 'app/models/messaged/message.rb', line 28

def owner
  return user if user
  return messaged_room if messaged_room
  return tenant if Messaged.tenant_class_name && tenant
  return nil # replace with user, tenant, or room
end