Created
January 31, 2014 22:24
-
-
Save andrewpthorp/8744501 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Captain.TicketsShowRoute = Ember.Route.extend | |
model: (params) -> | |
@store.find('ticket', params['ticket_id']) | |
setupController: (controller, model) -> | |
controller.set('model', model) | |
controller.set('queues', @store.all('queue')) | |
renderTemplate: -> | |
@render 'tickets/show' | |
Captain.Ticket = DS.Model.extend | |
ticket_number: DS.attr('string') | |
subject: DS.attr('string') | |
state: DS.attr('string') | |
merchant: DS.attr('string') | |
email: DS.attr('string') | |
messages: DS.hasMany('message') | |
queue: DS.attr('string') | |
Captain.TicketSerializer = DS.ActiveModelSerializer.extend DS.EmbeddedRecordsMixin, | |
attrs: { | |
messages: { embedded: 'always' } | |
} | |
Captain.Queue = DS.Model.extend | |
name: DS.attr('string') | |
unassigned: DS.attr('boolean') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What I know is the following:
@store.getById('queue', '12345')
returns aCaptain.Queue
console.log model.get('queue')
on line 6, prints '12345'However, if I change line 17 to the following:
queue: DS.belongsTo('queue')
console.log model.get('queue')
on line 6, printsnull