Sha256: cbeb55a2b58dd6bb8cb60cba763aa886e31660983b2f7e06940c42f3ceb0d352

Contents?: true

Size: 353 Bytes

Versions: 5

Compression:

Stored size: 353 Bytes

Contents

class TrendCounter < ActiveRecord::Base
  belongs_to :trend
  validates_numericality_of :count, :greater_than_or_equal_to => 0
  validates_uniqueness_of :created_at, :scope => :trend_id
  default_scope :order => "created_at"
  scope :recent, lambda { |*args| {:conditions => ["created_at > ?", (args.first || 30.day.ago)], :order => "created_at"} }
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/app/models/trend_counter.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/models/trend_counter.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/models/trend_counter.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/models/trend_counter.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/models/trend_counter.rb