Skip to content

Instantly share code, notes, and snippets.

@skizzybiz
Created April 20, 2011 20:05
Show Gist options
  • Save skizzybiz/932584 to your computer and use it in GitHub Desktop.
Save skizzybiz/932584 to your computer and use it in GitHub Desktop.
> e = MT.store.find(MT.WhitelistEntry, 1)
Object
> e.get('reportTemplate').get('id')
1
> t = MT.store.find(MT.ReportTemplate, 1)
Object
> t.get('whitelistEntries').length()
0
MT.Base = SC.Record.extend({
primaryKey: 'id'
});
MT.ReportTemplate = MT.Base.extend({
name: SC.Record.attr(String),
email: SC.Record.attr(String),
dsid: SC.Record.attr(Number),
description: SC.Record.attr(String),
whitelistEntries: SC.Record.toMany('MT.WhitelistEntry', {
isMaster: YES,
key: "report_template_id",
inverse: "reportTemplate"
})
});
MT.WhitelistEntry = MT.Base.extend({
domain: SC.Record.attr(String),
reportTemplate: SC.Record.toOne('MT.ReportTemplate', {
isMaster: NO,
key: "report_template_id"
}),
});
MT.ReportTemplate.FIXTURES = [
{
id: 1,
name: "Test",
email: "blah...",
dsid: 12345,
description: "Measures statistics...",
approved: false,
parent_id: null
}
];
MT.WhitelistEntry.FIXTURES = [
{
id: 1,
report_template_id: 1,
domain: "org.example.blah"
}
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment