Skip to content

Instantly share code, notes, and snippets.

@kenelliott
Created October 30, 2013 13:15
Show Gist options
  • Save kenelliott/7232482 to your computer and use it in GitHub Desktop.
Save kenelliott/7232482 to your computer and use it in GitHub Desktop.
how do you create hasMany records on a parent model?
App.Company = Ember.Model.extend
name: DS.attr()
addresses: DS.hasMany 'address'
App.Address = Ember.Model.extend
city: DS.attr()
company: DS.belongsTo 'company'
App.CompanyNewController = Ember.ObjectController.extend
model: ->
@get('store').createRecord('company',
name: "test company",
# How do I create default hasMany relationship objects??
addresses:
city: "Timbuktu"
,
city: "Hoboken"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment