From 0f710bbd1f90b9f966be84d1a001a4b0880aee62 Mon Sep 17 00:00:00 2001 From: Marcela Ribeiro de Oliveira <mro15@inf.ufpr.br> Date: Wed, 4 Jul 2018 09:57:36 -0300 Subject: [PATCH] change find to where in user likes --- app/controllers/concerns/publisher_controller.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/controllers/concerns/publisher_controller.rb b/app/controllers/concerns/publisher_controller.rb index e11aa0f5..1f21ebec 100644 --- a/app/controllers/concerns/publisher_controller.rb +++ b/app/controllers/concerns/publisher_controller.rb @@ -50,15 +50,13 @@ module PublisherController def show_liked_learning_objects includes = [:taggings, :tags, :subject_relations, :subjects, :stage_relations, :educational_stages, :publisher, :language, :license] - learning_objects = paginate LearningObject.includes(includes).find( - Like.where(user: @publisher, likeable_type: 'LearningObject').pluck(:likeable_id) + learning_objects = paginate LearningObject.includes(includes).where(id: Like.where(user: @publisher, likeable_type: 'LearningObject').pluck(:likeable_id) ) render json: learning_objects end def show_liked_collections - collections = paginate Collection.find( - Like.where(user: @publisher, likeable_type: 'Collection').pluck(:likeable_id) + collections = paginate Collection.where( id: Like.where(user: @publisher, likeable_type: 'Collection').pluck(:likeable_id) ) render json: collections end -- GitLab