Sha256: 07ce8d0584ec87b48f9e5abaee48dbb30247ce625db6ed26deae0df3c6fa1d1d

Contents?: true

Size: 344 Bytes

Versions: 3

Compression:

Stored size: 344 Bytes

Contents

module Dolly
  module Timestamps

    def timestamps!
      property :created_at, :updated_at, class_name: DateTime

      Dolly::Document.class_eval do
        def set_created_at
          self.created_at ||= DateTime.now
        end

        def set_updated_at
          self.updated_at = DateTime.now
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dolly-0.9.0 lib/dolly/timestamps.rb
dolly-0.8.1 lib/dolly/timestamps.rb
dolly-0.8.0 lib/dolly/timestamps.rb