Module: Jsonoid::Timestamps
- Defined in:
- lib/jsonoid/timestamps.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.append_features(base) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/jsonoid/timestamps.rb', line 11 def append_features(base) super base.field :created_at, :type => DateTime base.field :updated_at, :type => DateTime base.before_save :update_timestamps end |
Instance Method Details
#update_timestamps ⇒ Object
5 6 7 8 |
# File 'lib/jsonoid/timestamps.rb', line 5 def self.updated_at = Time.now.utc self.created_at = self.updated_at if new_record? end |