Created
February 5, 2010 19:47
-
-
Save deanlandolt/296150 to your computer and use it in GitHub Desktop.
This file contains 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
// this fails with MethodNotAllowedError: SubModel is not allowed | |
var JSFile = require("store/js-file").JSFile; | |
var dataPath = (require("settings").dataFolder || "data") + "/"; | |
var Package = require("package").Package; | |
var foo = Package("foo"); | |
foo.bar = foo.Package("bar"); | |
foo.bar.baz = foo.bar.SubModel("baz", | |
JSFile(dataPath + "store1.json"), | |
{ | |
prototype: { | |
testMethod: function(){ | |
return this.foo; | |
} | |
}, | |
staticMethod: function(id) { | |
return this.get(id); | |
}, | |
properties: { | |
foo: {type: "number"} | |
}, | |
links: [ | |
{rel: "foo", href: "{foo}"} | |
] | |
} | |
); |
This file contains 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
// this fails with MethodNotAllowedError: Package is not allowed | |
var Package = require("package").Package; | |
var foo = Package("foo"); | |
foo.bar = foo.Package("bar"); | |
foo.bar.baz = foo.bar.Package("baz"); |
This file contains 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
// this works | |
var JSFile = require("store/js-file").JSFile; | |
var dataPath = (require("settings").dataFolder || "data") + "/"; | |
var foo = Package("foo"); | |
foo.baz = foo.SubModel("baz", | |
JSFile(dataPath + "store1.json"), | |
{ | |
prototype: { | |
testMethod: function(){ | |
return this.foo; | |
} | |
}, | |
staticMethod: function(id) { | |
return this.get(id); | |
}, | |
properties: { | |
foo: {type: "number"} | |
}, | |
links: [ | |
{rel: "foo", href: "{foo}"} | |
] | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment