Skip to content
Snippets Groups Projects
Commit 7064bfbf authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

now, like action toggle between like and dislike learning objects

parent 0a1f91f1
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,11 @@ class LearningObjectsController < ApplicationController
# POST /learning_objects/1/like
def like
learning_object_repository.like current_user, @learning_object
if @learning_object.liked? current_user
@learning_object.dislike current_user
else
@learning_object.like current_user
end
if request.xhr?
render json: {count: @learning_object.likes, id: params[:id]}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment