diff --git a/app/controllers/likes_controller.rb b/app/controllers/likes_controller.rb index c5750bee5..8822af378 100644 --- a/app/controllers/likes_controller.rb +++ b/app/controllers/likes_controller.rb @@ -11,7 +11,13 @@ class LikesController < ApplicationController :json def create - @like = current_user.like!(target) if target rescue ActiveRecord::RecordInvalid + begin + @like = if target + current_user.like!(target) + end + rescue ActiveRecord::RecordInvalid => e + # do nothing + end if @like respond_to do |format|