Sha256: 0ff36d4d5282b6f2b474a8817b259c5bd1987bdcb2f32515477d2a8ccfa57d0d

Contents?: true

Size: 293 Bytes

Versions: 1

Compression:

Stored size: 293 Bytes

Contents

class NanoMetrics::Metric < ActiveRecord::Base
  self.table_name = 'nano_metrics'

  belongs_to :context

  validates :context, presence: true
  validates :time,    presence: true

  before_validation :set_time, on: :create

  private

  def set_time
    self.time ||= Time.zone.now
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nano_metrics-0.0.1 app/models/nano_metrics/metric.rb