Class: SocialNetworking::LikesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/social_networking/likes_controller.rb

Overview

Manage Likes.

Constant Summary

Constants inherited from ApplicationController

ApplicationController::CSRF_COOKIE_NAME, ApplicationController::CSRF_HEADER_NAME

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/social_networking/likes_controller.rb', line 9

def create
  @like = Like.new(sanitized_params)

  if @like.save
    set_recipient
    build_notification.notify
    render json: Serializers::LikeSerializer.new(@like).to_serialized
  else
    render json: { error: model_errors }, status: 400
  end
end