cirandas.net

ref: master

app/models/search_term_occurrence.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
class SearchTermOccurrence < ApplicationRecord

  belongs_to :search_term
  validates_presence_of :search_term
  attr_accessible :search_term, :created_at, :total, :indexed

  EXPIRATION_TIME = 1.year

  scope :valid, -> { where "search_term_occurrences.created_at > ?", DateTime.now - EXPIRATION_TIME }

end