Sha256: 6df6f81f8ab68dfef66e955e2e207019abedb95d39823f4347d7494dde563f6b

Contents?: true

Size: 308 Bytes

Versions: 1

Compression:

Stored size: 308 Bytes

Contents

module Yapper::Timestamps
  extend MotionSupport::Concern

  included do
    field :updated_at, :type => Time
    field :created_at, :type => Time

    before_save :set_timestamps
  end

  def set_timestamps
    now = Time.now
    self.created_at = now if created_at.nil?
    self.updated_at = now
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-yapper-0.0.1 lib/yapper/timestamps.rb