Skip to content

Commit

Permalink
Merge pull request #812 from locomote/feature/fix-accessors-issue
Browse files Browse the repository at this point in the history
Feature/fix accessors issue
  • Loading branch information
dxg authored Sep 28, 2017
2 parents 4892353 + 9a75b34 commit 8c3f994
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v4.0.1
- Fix undefinedAsync accessor methods.

### v4.0.0
- Added Promise support (see readme & wiki) ([#807](../../pull/807))

Expand Down
10 changes: 2 additions & 8 deletions lib/Associations/Many.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ exports.prepare = function (db, Model, associations) {
}) ||
util.formatField(OtherModel, name, true, opts.reversed),
{ makeKey: makeKey, required: true }
)
);

var assocName = opts.name || ucfirst(name);
var assocTemplateName = opts.accessor || assocName;
Expand All @@ -84,13 +84,7 @@ exports.prepare = function (db, Model, associations) {
setAccessor : opts.setAccessor || ("set" + assocTemplateName),
hasAccessor : opts.hasAccessor || ("has" + assocTemplateName),
delAccessor : opts.delAccessor || ("remove" + assocTemplateName),
addAccessor : opts.addAccessor || ("add" + assocTemplateName),

getAccessorAsync : opts.getAccessor + promiseFunctionPostfix || ("get" + assocTemplateName + promiseFunctionPostfix),
setAccessorAsync : opts.setAccessor + promiseFunctionPostfix || ("set" + assocTemplateName + promiseFunctionPostfix),
hasAccessorAsync : opts.hasAccessor + promiseFunctionPostfix || ("has" + assocTemplateName + promiseFunctionPostfix),
delAccessorAsync : opts.delAccessor + promiseFunctionPostfix || ("remove" + assocTemplateName + promiseFunctionPostfix),
addAccessorAsync : opts.addAccessor + promiseFunctionPostfix || ("add" + assocTemplateName + promiseFunctionPostfix)
addAccessor : opts.addAccessor || ("add" + assocTemplateName)
};
associations.push(association);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"sqlite",
"mongodb"
],
"version": "4.0.0",
"version": "4.0.1",
"license": "MIT",
"homepage": "http://dresende.github.io/node-orm2",
"repository": "http://github.com/dresende/node-orm2.git",
Expand Down

0 comments on commit 8c3f994

Please sign in to comment.