Permalink
Browse files

Persistence: add a function to get a model by id

  • Loading branch information...
1 parent 816fd74 commit 26b701de279bd0ef177958df8b36b9eee0f10279 @drublic committed Apr 13, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/js/persistence.js
View
@@ -54,6 +54,17 @@ Modeller.Storage = (function () {
return Modeller[type].create(this.data[model.get('id')]);
};
+
+ // Retrieve a model by id.
+ this.findById = function (id, type) {
+ if (type === undefined) {
+ type = "Modell";
+ }
+
+ return Modeller[type].create(this.data[id]);
+ };
+
+
// Return the array of all models currently in storage.
this.findAll = function() {
var result = [];

0 comments on commit 26b701d

Please sign in to comment.