Skip to content

Instantly share code, notes, and snippets.

@topherfangio
Created March 12, 2011 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save topherfangio/867578 to your computer and use it in GitHub Desktop.
Save topherfangio/867578 to your computer and use it in GitHub Desktop.
Problems with Associations
Pharos360.Course = SC.Record.extend(
/** @scope Pharos360.Course.prototype */ {
primaryKey: 'number',
number: SC.Record.attr(Number),
title: SC.Record.attr(String),
faculty_uid: SC.Record.attr(String),
credit_hours: SC.Record.attr(String),
days: SC.Record.attr(String),
start_time: SC.Record.attr(String),
finish_time: SC.Record.attr(String),
bldg: SC.Record.attr(String),
room: SC.Record.attr(String),
class_type: SC.Record.attr(String),
member: SC.Record.toOne('Pharos360.Member', { isMaster: NO, key:'faculty_uid' })
});
Pharos360.Member = SC.Record.extend(
/** @scope Pharos360.Member.prototype */ {
primaryKey: 'username',
username: SC.Record.attr(String),
fullname: SC.Record.attr(String),
email: SC.Record.attr(String),
courses: SC.Record.toMany('Pharos360.Course', { isMaster: YES, inverse: 'member', key:'username' })
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment