app/models/rostra/question.rb in rostra-0.0.5 vs app/models/rostra/question.rb in rostra-0.0.6
- old
+ new
@@ -13,16 +13,18 @@
validates :tag_list, :presence => true
# Finds questions asked within the last 15 days ordered by non-unique page views.
#
def self.trending(limit = 5)
- return [] if Question.count.zero?
Question
- .where(created_at: (15.days.ago)..(Time.now))
- .limit(limit)
- .joins(:impressions)
- .group('impressions.impressionable_id')
- .order('count(impressions.impressionable_id) desc')
+ .where(created_at: (15.days.ago)..(Time.now)).limit(limit)
+
+ # Question
+ # .where(created_at: (15.days.ago)..(Time.now))
+ # .limit(limit)
+ # .joins(:impressions)
+ # .group('impressions.impressionable_id')
+ # .order('count(impressions.impressionable_id) desc')
end
def answer_count
@answer_count = answers.count
end