Module: Mongoid::Timestamps

Defined in:
lib/mongoid/timestamps.rb

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/mongoid/timestamps.rb', line 4

def self.included(base)
  base.class_eval do
    include InstanceMethods
    field :created_at, :type => Time
    field :modified_at, :type => Time
    before_create :update_created_at, :update_modified_at
    before_save :update_modified_at
  end
end