module Minidoc::Timestamps
Public Instance Methods
atomic_set(query, attributes)
click to toggle source
Calls superclass method
# File lib/minidoc/timestamps.rb, line 26 def atomic_set(query, attributes) if self.class.record_timestamps super(query, attributes.merge(updated_at: Time.now.utc)) else super(query, attributes) end end
set(attributes)
click to toggle source
Calls superclass method
# File lib/minidoc/timestamps.rb, line 18 def set(attributes) if self.class.record_timestamps super(attributes.merge(updated_at: Time.now.utc)) else super(attributes) end end
unset(*keys)
click to toggle source
Calls superclass method
# File lib/minidoc/timestamps.rb, line 34 def unset(*keys) super set(updated_at: Time.now.utc) if self.class.record_timestamps end
Private Instance Methods
create()
click to toggle source
Calls superclass method
# File lib/minidoc/timestamps.rb, line 42 def create if self.class.record_timestamps current_time = Time.now.utc self.created_at = current_time self.updated_at = current_time end super end
update()
click to toggle source
Calls superclass method
# File lib/minidoc/timestamps.rb, line 52 def update if self.class.record_timestamps self.updated_at = Time.now.utc end super end