diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index ee577d7..df2419b 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -294,8 +294,6 @@ class QuestionsController < InheritedResources::Base end def index - @questions = current_user.questions.scoped({}) - @questions = @questions.created_by(params[:creator]) if params[:creator] counts = {} if params[:user_ideas] @@ -314,6 +312,14 @@ class QuestionsController < InheritedResources::Base :group => "votes.question_id") end + # only return questions with these recent votes + if counts['recent-votes'] && params[:all] != 'true' + @questions = current_user.questions.scoped({}).find(counts['recent-votes'].keys) + else + @questions = current_user.questions.scoped({}) + @questions = @questions.created_by(params[:creator]) if params[:creator] + end + # There doesn't seem to be a good way to add procs to an array of # objects. This solution depends on Array#to_xml rendering each # member in the correct order. Internally, it just uses, #each, so -- libgit2 0.21.2