Sha256: 2f748490ccb5683c369ce9b46f368e402365650dab3a8696c8b3be2533dc99da
Contents?: true
Size: 476 Bytes
Versions: 11
Compression:
Stored size: 476 Bytes
Contents
module MongoMapper module Plugins module Timestamps module ClassMethods def timestamps! key :created_at, Time key :updated_at, Time class_eval { before_save :update_timestamps } end end module InstanceMethods def update_timestamps now = Time.now.utc self[:created_at] = now if new? && !created_at? self[:updated_at] = now end end end end end
Version data entries
11 entries across 11 versions & 4 rubygems