Created
October 25, 2011 11:23
-
-
Save benpickles/1312371 to your computer and use it in GitHub Desktop.
Finding model with custom IDs not working
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
var Activity = Model("activity", function() { | |
this.persistence(Model.REST, "/activity"); | |
this.unique_key = '_id'; | |
}); | |
$(function() { | |
Activity.load(function() { | |
console.log(Activity.all()) | |
var one_activity = Activity.find('fa7043e52b644cd3a7a2217edc0e8928'); | |
console.log(one_activity) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hm, I'm going to double-check but I think my controller is returning a list of activities like this:
[{ "_id": "fa7043e52b644cd3a7a2217edc0e8928", "type": "something else"}, { "_id": "33156bf35c6245408e20f1e82f2971f9", "type": "something"}]. Does js-model add the root node somehow (is name of the model in model definition a factor)?