Skip to content

Instantly share code, notes, and snippets.

@razum2um
Created December 10, 2012 13:36
Show Gist options
  • Save razum2um/4250600 to your computer and use it in GitHub Desktop.
Save razum2um/4250600 to your computer and use it in GitHub Desktop.
Schools GET /api/schools/?username=contractor
GET /api/schools/?username=contractor
HTTP 200 OK
Vary: Accept
Content-Type: text/html
Allow: OPTIONS, GET
{
"schools": [
{
"id": 1,
"started": 1996,
"region": 33,
"city": 693,
"type": 1,
"name": "\u041c\u041e\u0423 \u0421\u041e\u0428 \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u0448\u043a\u043e\u043b\u0430 127",
"grade": 10,
"finished": 2006
}
]
}
App.schools = App.store.find(App.School, {username: username});
App.schools.mapProperty('id')
["1"]
App.Education = DS.Model.extend({
name: DS.attr('string'),
started: DS.attr('number'),
finished: DS.attr('number'),
grade: DS.attr('string'),
country: DS.belongsTo('App.Country'),
region: DS.belongsTo('App.Region'),
city: DS.belongsTo('App.City'),
contractor: DS.belongsTo('App.Contractor')
});
App.School = App.Education.extend({
});
App.store = DS.Store.create({
revision: 8,
adapter: DS.RESTAdapter.create({
bulkCommit: false,
mappings: {
schools: App.School
},
namespace: 'api',
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment