Class: Denshobato::Conversation

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
HelperUtils
Defined in:
lib/denshobato/models/conversation.rb

Instance Method Summary collapse

Instance Method Details

#from_trashObject



44
45
46
47
48
# File 'lib/denshobato/models/conversation.rb', line 44

def from_trash
  # Move conversation from trash

  to_trash { false }
end

#messagesObject

Methods



30
31
32
33
34
35
# File 'lib/denshobato/models/conversation.rb', line 30

def messages
  # Return all messages of conversation

  ids = notifications.pluck(:message_id)
  hato_message.where(id: ids)
end

#to_trashObject



37
38
39
40
41
42
# File 'lib/denshobato/models/conversation.rb', line 37

def to_trash
  # Move conversation to trash

  bool = block_given? ? yield : true
  update(trashed: bool)
end