module Shoden::Timestamps

Public Class Methods

included(model) click to toggle source
# File lib/shoden/timestamps.rb, line 5
def self.included(model)
  model.attribute :created_at, DataTypes::Type::Timestamp
  model.attribute :updated_at, DataTypes::Type::Timestamp
end

Public Instance Methods

save() click to toggle source
Calls superclass method
# File lib/shoden/timestamps.rb, line 10
def save
  self.created_at = Time.now.utc.to_i if @_id.nil?
  self.updated_at = Time.now.utc.to_i

  super
end