Module: Mongoid::Reloadable
- Included in:
- Composable
- Defined in:
- lib/mongoid/reloadable.rb
Overview
This module handles reloading behavior of documents.
Instance Method Summary collapse
-
#reload ⇒ Document
Reloads the
Document
attributes from the database.
Instance Method Details
#reload ⇒ Document
Reloads the Document
attributes from the database. If the document has not been saved then an error will get raised if the configuration option was set. This can reload root documents or embedded documents.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mongoid/reloadable.rb', line 16 def reload reloaded = _reload check_for_deleted_document!(reloaded) reset_object!(reloaded) run_callbacks(:find) unless _find_callbacks.empty? run_callbacks(:initialize) unless _initialize_callbacks.empty? self end |