Skip to content

Instantly share code, notes, and snippets.

@jakecraige
Created January 3, 2014 20:10
Show Gist options
  • Save jakecraige/8245586 to your computer and use it in GitHub Desktop.
Save jakecraige/8245586 to your computer and use it in GitHub Desktop.
saveNewPhoto: ->
newImage = @store.createRecord 'event_image', {
image: @get 'newPhotoImage'
caption: @get 'newPhotoCaption'
event: @get 'model'
}
newImage.save().then ((img)=>
@get('event_images').pushObject img
Ea.get('flash').success 'Image added'
), (=>
Ea.get('flash').alert 'Error adding image. Please try again later.'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment