Sha256: cae716c842a45450c4deb975882ce69b1b10dafb64b92a9cc80374f8c04def99

Contents?: true

Size: 419 Bytes

Versions: 12

Compression:

Stored size: 419 Bytes

Contents

module CassandraObject
  module Timestamps
    extend ActiveSupport::Concern

    included do
      attribute :created_at, type: :time#_with_zone
      attribute :updated_at, type: :time#_with_zone

      before_create do
        self.created_at ||= Time.current
        self.updated_at ||= Time.current
      end

      before_update if: :changed? do
        self.updated_at = Time.current
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gotime-cassandra_object-2.10.8 lib/cassandra_object/timestamps.rb
gotime-cassandra_object-2.10.7 lib/cassandra_object/timestamps.rb
gotime-cassandra_object-2.10.6 lib/cassandra_object/timestamps.rb
gotime-cassandra_object-2.10.5 lib/cassandra_object/timestamps.rb
gotime-cassandra_object-2.10.4 lib/cassandra_object/timestamps.rb
gotime-cassandra_object-2.10.3 lib/cassandra_object/timestamps.rb
gotime-cassandra_object-2.10.2 lib/cassandra_object/timestamps.rb
gotime-cassandra_object-2.10.1 lib/cassandra_object/timestamps.rb
gotime-cassandra_object-2.10.0 lib/cassandra_object/timestamps.rb
gotime-cassandra_object-2.9.2 lib/cassandra_object/timestamps.rb
gotime-cassandra_object-2.9.1 lib/cassandra_object/timestamps.rb
gotime-cassandra_object-2.9.0 lib/cassandra_object/timestamps.rb