module Mingo::Timestamps
Public Class Methods
included(base)
click to toggle source
# File lib/mingo/timestamps.rb, line 3 def self.included(base) base.before_update :touch_updated_timestamp end
Public Instance Methods
created_at()
click to toggle source
# File lib/mingo/timestamps.rb, line 7 def created_at @created_at ||= self.id && self.id.generation_time end
updated_at()
click to toggle source
# File lib/mingo/timestamps.rb, line 11 def updated_at self['updated_at'] || created_at end
Protected Instance Methods
touch_updated_timestamp()
click to toggle source
# File lib/mingo/timestamps.rb, line 17 def touch_updated_timestamp self['updated_at'] = Time.now if changed? end