Class: Conversations::UserConversationsController

Inherits:
ApplicationController
  • Object
show all
Includes:
ApplicationHelper
Defined in:
app/controllers/conversations/user_conversations_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
# File 'app/controllers/conversations/user_conversations_controller.rb', line 5

def index
  @user = User.find params[:user_id]
  @conversations = @user.user_conversations
end

#mark_as_readObject



16
17
18
19
20
# File 'app/controllers/conversations/user_conversations_controller.rb', line 16

def mark_as_read
  @conversation = UserConversation.find params[:id]
  @conversation.update_attributes :read => true
  redirect_to user_conversation_path(current_user, @conversation)
end

#mark_as_unreadObject



22
23
24
25
26
# File 'app/controllers/conversations/user_conversations_controller.rb', line 22

def mark_as_unread
  @conversation = UserConversation.find params[:id]
  @conversation.update_attributes :read => false
  redirect_to user_conversation_path(current_user, @conversation)
end

#showObject



10
11
12
13
14
# File 'app/controllers/conversations/user_conversations_controller.rb', line 10

def show
  @user = User.find params[:user_id]
  @conversation = UserConversation.find params[:id]
  @message = @conversation.conversation.messages.build
end