Skip to content

Instantly share code, notes, and snippets.

@validkeys
Created July 20, 2014 19:32
Show Gist options
  • Select an option

  • Save validkeys/dcf17ed0b460a0f933e3 to your computer and use it in GitHub Desktop.

Select an option

Save validkeys/dcf17ed0b460a0f933e3 to your computer and use it in GitHub Desktop.
`import Ember from 'ember'`
PostRoute = Ember.Route.extend
model: (params) ->
@store.find('post', params.post_id)
afterModel: (model) ->
childPosts = []
@store.find('post',
parent: model.get('id')
iteration: @modelFor('iteration').get('id')
).then( (child_posts) ->
childPosts = child_posts.get("content")
model.get('posts')
).then( (posts) ->
_.each childPosts, (cp) -> posts.pushObject cp
)
setupController: (controller, model) ->
controller
.set('model', model)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment