Method: Mongoid::Document::ClassMethods#construct_document
- Defined in:
- lib/mongoid/document.rb
#construct_document(attrs = nil, options = {}) ⇒ Document
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Note:
A Ruby 2.x bug prevents the options hash from being keyword arguments. Once we drop support for Ruby 2.x, we can reimplement the options hash as keyword arguments. See bugs.ruby-lang.org/issues/15753
Allocates and constructs a document.
441 442 443 444 |
# File 'lib/mongoid/document.rb', line 441 def construct_document(attrs = nil, = {}) execute_callbacks = .fetch(:execute_callbacks, Threaded.execute_callbacks?) with_callbacks(execute_callbacks) { new(attrs) } end |