Skip to content

Commit

Permalink
Add __sql prop
Browse files Browse the repository at this point in the history
  • Loading branch information
biggora committed May 6, 2013
1 parent 1df4d34 commit 7b28aeb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ User.create(data, callback);
Read the tests for usage examples: ./test/common_test.js
Validations: ./test/validations_test.js



## Your own database adapter

To use custom adapter, pass it's package name as first argument to `Schema` constructor:
Expand Down
9 changes: 8 additions & 1 deletion lib/abstract-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,18 @@ function AbstractClass(data) {

AbstractClass.prototype._initProperties = function (data, applySetters) {
var self = this;
var ctor = this.constructor;
var ctor = self.constructor;
var ds = ctor.schema.definitions[ctor.modelName];
var properties = ds.properties;
data = data || {};

Object.defineProperty(this, '__sql', {
writable: true,
enumerable: false,
configurable: true,
value: {}
});

Object.defineProperty(this, '__cachedRelations', {
writable: true,
enumerable: false,
Expand Down

0 comments on commit 7b28aeb

Please sign in to comment.