Guest User

Untitled

a guest
Jul 20th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. class Topic < ActiveRecord::Base
  2.  
  3. before_create :set_start_trending
  4.  
  5. scope :trending_top, lambda { |num| where("started_trending > ?", 1.day.ago).order('mentions desc').limit(num) }
  6.  
  7.  
  8. private
  9.  
  10. def set_start_trending
  11. self.started_trending = Time.now
  12. end
  13.  
  14. end
Add Comment
Please, Sign In to add comment