Module: ArDocStore::EmbeddableModel::ClassMethods

Defined in:
lib/ar_doc_store/embeddable_model.rb

Instance Method Summary collapse

Instance Method Details

#build(attrs = HashWithIndifferentAccess.new, parent = nil) ⇒ Object



103
104
105
106
107
108
109
110
111
# File 'lib/ar_doc_store/embeddable_model.rb', line 103

def build(attrs=HashWithIndifferentAccess.new, parent = nil)
  model = if attrs.is_a?(self.class)
            attrs
          else
            new(attrs)
          end
  model.parent = parent
  model
end