Sha256: c31ea28ba6364d6c2fa92a4a335692a398dc5a4806ed91ed2410de1b49e1b9fd
Contents?: true
Size: 434 Bytes
Versions: 3
Compression:
Stored size: 434 Bytes
Contents
module Id module Timestamps def self.included(base) base.field :created_at base.field :updated_at end def initialize(data = {}) super data.merge(:created_at => data.fetch('created_at', Time.now)) end def set(values) self.class.new(super.data.merge(:updated_at => Time.now)) end def unset(*keys) self.class.new(super.data.merge(:updated_at => Time.now)) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
id-0.0.12 | lib/id/timestamps.rb |
id-0.0.11 | lib/id/timestamps.rb |
id-0.0.10 | lib/id/timestamps.rb |