lib/cassandra_object/timestamps.rb in extendi-cassandra_object-1.0.9 vs lib/cassandra_object/timestamps.rb in extendi-cassandra_object-1.0.10

- old
+ new

@@ -5,15 +5,19 @@ included do attribute :created_at, type: :time attribute :updated_at, type: :time before_create do - self.created_at ||= Time.current - self.updated_at ||= Time.current + if self.class.timestamps + self.created_at ||= Time.current + self.updated_at ||= Time.current + end end before_update if: :changed? do - self.updated_at = Time.current + if self.class.timestamps + self.updated_at = Time.current + end end end end end