Module: Armada::Timestamp

Extended by:
ActiveSupport::Concern
Defined in:
lib/armada/timestamp.rb

Instance Method Summary collapse

Instance Method Details

#touch(attribute = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/armada/timestamp.rb', line 15

def touch(attribute = nil)
  current_time = current_time_from_current_timezone
 
  if attribute
    write_attribute(attribute, current_time)
  else
    write_attribute('updated_at', current_time) if respond_to?(:updated_at)
    write_attribute('updated_on', current_time) if respond_to?(:updated_on)
  end
 
  save!
end