Sha256: 9bff7d3305218320f7fc932ac82b2699de92df82317e29abe3d307b3624f6bce

Contents?: true

Size: 831 Bytes

Versions: 4

Compression:

Stored size: 831 Bytes

Contents

module Conversations
  class UserConversationsController < ::ApplicationController
    include ApplicationHelper

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

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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
conversations-0.0.2.2 app/controllers/conversations/user_conversations_controller.rb
conversations-0.0.2.1 app/controllers/conversations/user_conversations_controller.rb
conversations-0.0.2 app/controllers/conversations/user_conversations_controller.rb
conversations-0.0.1 app/controllers/conversations/user_conversations_controller.rb