You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 22, 2026. It is now read-only.
Bill Heaton edited this page Nov 20, 2016
·
5 revisions
Cookbook for creating records
The initializer that is created when you use the ember generate resource command sets up a factory in your application container. All the related factories/singletons are registered in your application container.
Admin Route
Using a protected group of routes that have features to administer content you can create new resources.
Here is an example methods for the model hook which uses a resource factory object to create new record.
† Note: eventually factoryFor will replace _lookupFactory.
A template of a form component can use the isNew flag as well as any default attributes you set on the attributes hash. When a resource has a true value for its isNew flag the events are not triggered to notify an adapter that the resource has changed attributes, as it's a new resource.
<p>
<strong>Create a Blog Post</strong>
</p>
{{form-postpost=modelisNew=model.isNewon-save="save"on-cancel="cancel"}}
See below for source code examples for create a new post. The example code uses the same form-post component to create and edit a resource. (Also the component uses buffering to delay the application of the changes to the resource instance.)