MCPcopy
hub / github.com/miragejs/miragejs / create

Method create

lib/orm/schema.js:193–195  ·  view source on GitHub ↗

Create a new model instance with attributes *attrs*, and insert it into the database. ```js let post = blogPosts.create({title: 'Lorem ipsum'}); post.title; // Lorem ipsum post.id; // 1 post.isNew(); // false ``` @method create @param type @param attrs

(type, attrs)

Source from the content-addressed store, hash-verified

191 @public
192 */
193 create(type, attrs) {
194 return this.new(type, attrs).save();
195 }
196
197 /**
198 Return all models in the database.

Callers 5

registerModelMethod · 0.95
findOrCreateByMethod · 0.95
handleStringShorthandMethod · 0.45

Calls 2

newMethod · 0.95
saveMethod · 0.45

Tested by

no test coverage detected