Module: Risky::Timestamps
- Defined in:
- lib/risky/timestamps.rb
Instance Method Summary collapse
- #before_create ⇒ Object
-
#before_save ⇒ Object
If created_at and/or updated_at are present, updates them before creation and save, respectively.
Instance Method Details
#before_create ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/risky/timestamps.rb', line 13 def before_create super begin self.created_at ||= Time.now rescue end end |
#before_save ⇒ Object
If created_at and/or updated_at are present, updates them before creation and save, respectively.
5 6 7 8 9 10 11 |
# File 'lib/risky/timestamps.rb', line 5 def before_save super begin self.updated_at = Time.now rescue end end |