Sha256: 2af3ac1a98e2a533cb2bc5a8d823cb839ada837686198f45a7db3b00e1ac8d8d

Contents?: true

Size: 430 Bytes

Versions: 3

Compression:

Stored size: 430 Bytes

Contents

module Ripple
  module Document
    module Timestamps
      extend ActiveSupport::Concern

      module ClassMethods
        def timestamps!
          property :created_at, Time, :default => proc { Time.now.utc }
          property :updated_at, Time
          before_save :touch
        end
      end

      module InstanceMethods
        def touch
          self.updated_at = Time.now.utc
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ripple-0.7.0 lib/ripple/document/timestamps.rb
ripple-0.6.1 lib/ripple/document/timestamps.rb
ripple-0.6.0 lib/ripple/document/timestamps.rb