module Flex::ActiveModel::Timestamps

Public Instance Methods

attribute_created_at(props={}) click to toggle source
# File lib/flex/active_model/timestamps.rb, line 10
def attribute_created_at(props={})
  attribute :created_at, {:type => DateTime}.merge(props)
  before_create { self.created_at = Time.now.utc }
end
attribute_timestamps(props={}) click to toggle source
# File lib/flex/active_model/timestamps.rb, line 5
def attribute_timestamps(props={})
  attribute_created_at props
  attribute_updated_at props
end
attribute_updated_at(props={}) click to toggle source
# File lib/flex/active_model/timestamps.rb, line 15
def attribute_updated_at(props={})
  attribute :updated_at, {:type => DateTime}.merge(props)
  before_save { self.updated_at = Time.now.utc }
end