Sha256: fa55dfce4474d5a3047fadeaabd7784489e4de0ae9b8febe3f1213ec53220f1b
Contents?: true
Size: 610 Bytes
Versions: 5
Compression:
Stored size: 610 Bytes
Contents
module CassandraObject module Timestamps extend ActiveSupport::Concern included do attribute :created_at, type: :time attribute :updated_at, type: :time before_create do if self.class.timestamps self.created_at ||= Time.current self.updated_at ||= Time.current end end before_update if: :changed? do if self.class.timestamps if store_updated_at.present? self.updated_at = store_updated_at else self.updated_at = Time.current end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems