summaryrefslogtreecommitdiff
path: root/app/controllers/v1/messages_controller.rb
blob: 85156b71c04f26d23240a35969061436679d6557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module V1
  class MessagesController < ApplicationController

    skip_before_filter :verify_authenticity_token
    before_filter :require_token

    respond_to :json

    def index
      render json: current_user.messages
    end

    def update
      if message = Message.find(params[:id])
        message.mark_as_read_by(current_user)
        message.save
        render json: true
      else
        render json: false
      end
    end

  end
end