Module: Ocm::Timestampable
- Defined in:
- lib/ocm/timestampable.rb
Instance Method Summary collapse
- #created_at ⇒ Object
- #created_at=(t) ⇒ Object
- #set_timestamps ⇒ Object
- #updated_at ⇒ Object
- #updated_at=(t) ⇒ Object
Instance Method Details
#created_at ⇒ Object
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_timestamps ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/ocm/timestampable.rb', line 20 def time = Time.now.utc if !created_at self.created_at = time end self.updated_at = time end |
#updated_at ⇒ Object
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 |