Solve #5348
This commit is contained in:
parent
7b0cff3250
commit
d75071bac9
1 changed files with 7 additions and 1 deletions
|
|
@ -11,7 +11,13 @@ class LikesController < ApplicationController
|
||||||
:json
|
:json
|
||||||
|
|
||||||
def create
|
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
|
if @like
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue