Sha256: b99193450a5181c3a39fa850fa3268c94c2724f9f6766096e1334785954b5cad

Contents?: true

Size: 429 Bytes

Versions: 152

Compression:

Stored size: 429 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 #|r|
        self.created_at ||= Time.current
        self.updated_at ||= Time.current
      end

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

Version data entries

152 entries across 152 versions & 2 rubygems

Version Path
sessionm-cassandra_object-4.0.32 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.31 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.30 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.29 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.28 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.27 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.26 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.25 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.24 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.23 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.22 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.21 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.20 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-2.7.5 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-2.7.4 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.18 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.17 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.16 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.15 lib/cassandra_object/timestamps.rb
sessionm-cassandra_object-4.0.14 lib/cassandra_object/timestamps.rb