module Cequel::Record::Timestamps::ClassMethods

Provides class methods for the Timestamps module

Protected Instance Methods

key(name, type, options = {}) click to toggle source
Calls superclass method
# File lib/cequel/record/timestamps.rb, line 34
        def key(name, type, options = {})
          super
          if type == :timeuuid && options[:auto]
            module_eval(<<-RUBY, __FILE__, __LINE__+1)
              def created_at
                read_attribute(#{name.inspect}).try(:to_time)
              end
            RUBY
          end
        end
timestamps() click to toggle source
# File lib/cequel/record/timestamps.rb, line 45
def timestamps
  column :updated_at, :timestamp

  if method_defined?(:created_at)
    before_save :set_updated_at
  else
    column :created_at, :timestamp

    before_create :set_created_and_updated_at
    before_update :set_updated_at
  end
end