Sha256: 65b6fb535891856704d8dc013ef4271508081cf8d772fb2e5c5fad88b17303fd
Contents?: true
Size: 1.22 KB
Versions: 28
Compression:
Stored size: 1.22 KB
Contents
# encoding: utf-8 module Mongoid module Timestamps # This module adds behaviour for turning off timestamping in single or # multiple calls. module Timeless extend ActiveSupport::Concern # Begin an execution that should skip timestamping. # # @example Save a document but don't timestamp. # person.timeless.save # # @return [ Document ] The document this was called on. # # @since 2.3.0 def timeless Threaded.timeless = true self end # Are we currently timestamping? # # @example Should timestamps be applied? # person.timestamping? # # @return [ true, false ] If the current thread is timestamping. # # @since 2.3.0 def timestamping? Threaded.timestamping? end module ClassMethods # Begin an execution that should skip timestamping. # # @example Create a document but don't timestamp. # Person.timeless.create(:title => "Sir") # # @return [ Class ] The class this was called on. # # @since 2.3.0 def timeless Threaded.timeless = true self end end end end end
Version data entries
28 entries across 28 versions & 2 rubygems