Module | Mongoid::State |
In: |
lib/mongoid/state.rb
|
This module contains the behaviour for getting the various states a document can transition through.
destroyed | [W] | |
flagged_for_destroy | [W] | |
new_record | [W] |
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.
@example Is the document destroyed?
person.destroyed?
@return [ true, false ] True if destroyed, false if not.
Returns whether or not the document has been flagged for deletion, but not destroyed yet. Used for atomic pulls of child documents.
@example Is the document flagged?
document.flagged_for_destroy?
@return [ true, false ] If the document is flagged.
@since 2.3.2
Checks if the document has been saved to the database. Returns false if the document has been destroyed.
@example Is the document persisted?
person.persisted?
@return [ true, false ] True if persisted, false if not.
Determine if the document can be pushed.
@example Is this pushable?
person.pushable?
@return [ true, false ] Is the document new and embedded?
Determine if the document can be set.
@example Is this settable?
person.settable?
@return [ true, false ] Is this document a new embeds one?
@since 2.1.0
Is the document updateable?
@example Is the document updateable?
person.updateable?
@return [ true, false ] If the document is changed and persisted.
@since 2.1.0