Models in an Ember application are associated with every route. Models are set up with data by either a route implementing the model
property in a v view using the {{link-to}}
helper, passing the model as an argument, or invoking a route's transitionTo
method, passing the model as its argument.
To create a new model, use the ember:model
subgenerator as follows:
$ yo ember:model Post title:string body:string image:string slug:string--coffee
The preceding command creates a new Ember model located at app/scripts/models/post_model.coffee
.
By passing the name of the model and default attributes as property:type
, they will be added to the model definition.