Sha256: c3b485e85e41a2a97e79e02d5cb4e3e4383812f7e596e7a28aa7f9c3b488a4df
Contents?: true
Size: 427 Bytes
Versions: 11
Compression:
Stored size: 427 Bytes
Contents
module ForemanStatistics class TrendCounter < ApplicationRecord self.table_name = 'trend_counters' belongs_to :trend validates :count, :numericality => { :greater_than_or_equal_to => 0 } validates :created_at, :uniqueness => { :scope => :trend_id } default_scope -> { order(:created_at) } scope :recent, ->(*args) { where('created_at > ?', (args.first || 30.days.ago)).order(:created_at) } end end
Version data entries
11 entries across 11 versions & 1 rubygems