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



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

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