Skip to content

Instantly share code, notes, and snippets.

@jarkko
Created May 16, 2014 12:35
Show Gist options
  • Save jarkko/ab9b598ceace6bf7fe74 to your computer and use it in GitHub Desktop.
Save jarkko/ab9b598ceace6bf7fe74 to your computer and use it in GitHub Desktop.
Adding a new record to a hasMany relationship
App.SplitPointController = Ember.ObjectController.extend(
actions: {
recordSplit: ->
split = @store.createRecord('splitTime',
timestamp: new Date
splitPoint: @get('model')
)
@get('model').get('splitTimes').addObject(
split.save()
)
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment