Skip to content

Instantly share code, notes, and snippets.

@jackcallister
Created May 9, 2014 10:39
Show Gist options
  • Save jackcallister/580db1b3a981a6750699 to your computer and use it in GitHub Desktop.
Save jackcallister/580db1b3a981a6750699 to your computer and use it in GitHub Desktop.
Ember nested resources
App.Router.map ->
@resource 'schedules', ->
@resource 'schedule', { path: '/:schedule_id' }, ->
@resource 'events'
App.EventsRoute = Ember.Route.extend
model: ->
@modelFor('schedule').get('events')
App.Schedule = DS.Model.extend
title: DS.attr 'string'
events: DS.hasMany 'event'
App.Event = DS.Model.extend
title: DS.attr 'string'
schedule: DS.belongsTo 'schedule'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment