Class: Notee::CommentsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/notee/comments_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /comments



12
13
14
15
16
17
18
19
20
# File 'app/controllers/notee/comments_controller.rb', line 12

def create
  @comment = Comment.new(comment_params)

  if @comment.save
    render json: { status: 'success'}
  else
    render json: { status: 'failed'}
  end
end

#showObject



6
7
8
9
# File 'app/controllers/notee/comments_controller.rb', line 6

def show
  @comments = Comment.where(post_id: params[:id]);
  render json: { status: 'success', comments: @comments}
end