Sha256: 820803bcc5069d2d03b3fa0b0ab2576d1fe092bc25c567d4ec165b92cce4b14a
Contents?: true
Size: 929 Bytes
Versions: 21
Compression:
Stored size: 929 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc: module State #:nodoc: # Returns true if the +Document+ has not been persisted to the database, # false if it has. This is determined by the variable @new_record # and NOT if the object has an id. def new_record? @new_record == true end # Sets the new_record boolean - used after document is saved. def new_record=(saved) @new_record = saved end # Checks if the document has been saved to the database. def persisted? !new_record? end # Returns true if the +Document+ has been succesfully destroyed, and false if it hasn't. # This is determined by the variable @destroyed and NOT by checking the database. def destroyed? @destroyed == true end # Sets the destroyed boolean - used after document is destroyed. def destroyed=(destroyed) @destroyed = destroyed && true end end end
Version data entries
21 entries across 21 versions & 4 rubygems