Module: Ocm::Timestampable

Defined in:
lib/ocm/timestampable.rb

Instance Method Summary collapse

Instance Method Details

#created_atObject



4
5
6
# File 'lib/ocm/timestampable.rb', line 4

def created_at
  @created_at
end

#created_at=(t) ⇒ Object



8
9
10
# File 'lib/ocm/timestampable.rb', line 8

def created_at=(t)
  @created_at = t
end

#set_timestampsObject



20
21
22
23
24
25
26
# File 'lib/ocm/timestampable.rb', line 20

def set_timestamps
  time = Time.now.utc
  if !created_at
    self.created_at = time
  end
  self.updated_at = time
end

#updated_atObject



12
13
14
# File 'lib/ocm/timestampable.rb', line 12

def updated_at
  @updated_at
end

#updated_at=(t) ⇒ Object



16
17
18
# File 'lib/ocm/timestampable.rb', line 16

def updated_at=(t)
  @updated_at = t
end