Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. Basically, I have a `Model` type that has configurable `primaryKey`. This is my current implementation that appears broken—I'm guessing the better way to do this would be to build the `primaryKey` property in `init`.
  2.  
  3. ```javascript
  4. var Model = Ember.Object.extend({
  5. primaryKey: function() {
  6. return this.get(this.constructor.primaryKey);
  7. }.property().volatile(),
  8.  
  9. isNew: Ember.computed.none('primaryKey')
  10. }).reopenClass({
  11. primaryKey: 'id'
  12. });
  13.  
  14. var MyModel = Model.extend().reopenClass({
  15. primaryKey: 'uuid'
  16. });
  17. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement