module Denshobato::ConversationHelper
Public Instance Methods
find_conversation_with(user)
click to toggle source
# File lib/denshobato/helpers/core_modules/conversation_helper.rb, line 24 def find_conversation_with(user) # Return an existing conversation between sender and recipient hato_conversation.find_by(sender: self, recipient: user) end
make_conversation_with(recipient)
click to toggle source
# File lib/denshobato/helpers/core_modules/conversation_helper.rb, line 16 def make_conversation_with(recipient) # Build conversation # = form_for current_user.make_conversation_with(recipient) do |f| # = f.submit 'Start Chat', class: 'btn btn-primary' hato_conversations.build(recipient: recipient) end
my_conversations() { |: false| ... }
click to toggle source
# File lib/denshobato/helpers/core_modules/conversation_helper.rb, line 3 def my_conversations # Return active user conversations (which is not in trash) trashed = block_given? ? yield : false hato_conversation.my_conversations(self, trashed) end
trashed_conversations()
click to toggle source
# File lib/denshobato/helpers/core_modules/conversation_helper.rb, line 10 def trashed_conversations # Return trashed conversations my_conversations { true } # => hato_conversation.where trashed: true end