From 146567c9107dfcefec45eded44984a88230b2aef Mon Sep 17 00:00:00 2001 From: Junv Zhao Date: Sat, 24 Oct 2015 23:28:50 +0800 Subject: [PATCH] =?UTF-8?q?#13=20=E6=9C=89=E4=BA=86timeline=20source?= =?UTF-8?q?=EF=BC=8C=20timeline=20api=E7=9A=84=E6=8C=89=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E5=8F=98=E5=BE=97=E5=A5=BD=E7=AE=80=E5=8D=95?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/timeline_controller.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/timeline_controller.rb b/app/controllers/api/v1/timeline_controller.rb index e6fab89..404dc34 100644 --- a/app/controllers/api/v1/timeline_controller.rb +++ b/app/controllers/api/v1/timeline_controller.rb @@ -15,9 +15,8 @@ class Api::V1::TimelineController < Api::V1::ApplicationController def index if @current_user stars_ids = @current_user.stars.ids - shared_posts_ids = ShareInstance.where(user_id: stars_ids).order(created_at: :desc).pluck(:sharable_id) - # liked_posts_ids = Like.where(user_id: stars_ids).order(created_at: :desc).pluck(:likable_id) - render json: Post.find(shared_posts_ids).index_by(&:id).slice(*shared_posts_ids).values, each_serializer: EachPostSerializer + posts_ids = TimelineSource.where(user_id: stars_ids).order(created_at: :desc).pluck(:post_id) + render json: Post.find(posts_ids).index_by(&:id).slice(*posts_ids).values, each_serializer: EachPostSerializer else return most_liked end