Created
December 17, 2012 14:07
-
-
Save enyo/4318530 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
| Shop.jsonProducts = [{"_id":"50145602d71fe6bdb0000003","descriptionHtml":"","descriptionSource":null,"name":"",ect....] | |
| Shop.store.loadMany Shop.Product, Shop.jsonProducts |
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
| # The product object | |
| Shop.Product = Shop.Model.extend | |
| name: DS.attr "string" | |
| tagline: DS.attr "string" | |
| descriptionHtml: DS.attr "string" | |
| previewImage: DS.belongsTo("Shop.Image") | |
| images: DS.hasMany("Shop.Image") | |
| articles: DS.hasMany("Shop.Article", embedded: yes) |
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
| Shop.Adapter = DS.Adapter.extend | |
| find: (store, type, id) -> | |
| throw "Trying to load a record of type '#{type}'." | |
| findAll: (store, type) -> | |
| throw "Trying to load records of type '#{type}'." | |
| updateRecord: (store, type, model) -> | |
| throw "Trying to update a record of type '#{type}'." | |
| createRecord: (store, type, model) -> | |
| throw "Trying to create a record of type '#{type}'." | |
| findQuery: (store, type, query, modelArray) -> | |
| throw "Trying to load records of type '#{type}'." | |
| Shop.Adapter.map "Shop.Article", primaryKey: '_id' | |
| Shop.Adapter.map "Shop.Product", primaryKey: '_id' | |
| Shop.Adapter.map "Shop.image", primaryKey: '_id' | |
| Shop.store = DS.Store.create | |
| revision: 10 | |
| adapter: Shop.Adapter.create() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment