Module: Mongoid::Timestamps::InstanceMethods
- Defined in:
- lib/mongoid/timestamps.rb
Instance Method Summary collapse
-
#update_created_at ⇒ Object
Update the created_at field on the Document to the current time.
-
#update_modified_at ⇒ Object
Update the last_modified field on the Document to the current time.
Instance Method Details
#update_created_at ⇒ Object
Update the created_at field on the Document to the current time. This is only called on create.
18 19 20 |
# File 'lib/mongoid/timestamps.rb', line 18 def update_created_at self.created_at = Time.now.utc end |
#update_modified_at ⇒ Object
Update the last_modified field on the Document to the current time. This is only called on create and on save.
24 25 26 |
# File 'lib/mongoid/timestamps.rb', line 24 def update_modified_at self.modified_at = Time.now.utc end |