Adds recommendations on debates index

This commit is contained in:
decabeza
2018-03-28 01:40:29 +02:00
committed by Angel Perez
parent ecb0041b7f
commit 36a5ff39b8
6 changed files with 28 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ class DebatesController < ApplicationController
before_action :parse_tag_filter, only: :index
before_action :authenticate_user!, except: [:index, :show, :map]
before_action :set_view, only: :index
before_action :debates_recommendations, only: :index, if: :current_user
feature_flag :debates
@@ -57,4 +58,7 @@ class DebatesController < ApplicationController
@view = (params[:view] == "minimal") ? "minimal" : "default"
end
def debates_recommendations
@recommended_debates = Debate.recommendations(current_user).sort_by_random.limit(3)
end
end