Sha256: 9c49a7f509022fd8d2917cceaceffcee441259e0d79c477c357bc5893df1ea44
Contents?: true
Size: 697 Bytes
Versions: 3
Compression:
Stored size: 697 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc: module Timestamps extend ActiveSupport::Concern included do field :created_at, :type => Time field :updated_at, :type => Time before_save :set_created_at, :set_updated_at end module InstanceMethods # Update the created_at field on the Document to the current time. This is # only called on create. def set_created_at self.created_at = Time.now.utc if !created_at end # Update the updated_at field on the Document to the current time. # This is only called on create and on save. def set_updated_at self.updated_at = Time.now.utc end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
mongoid-pre-2.0.0.beta1 | lib/mongoid/timestamps.rb |
mongoid-2.0.0.alpha | lib/mongoid/timestamps.rb |
mongoid-pre-2.0.0.pre | lib/mongoid/timestamps.rb |