Skip to content

Commit

Permalink
add model instanceMethod .getModelName and close wejs/we#163
Browse files Browse the repository at this point in the history
  • Loading branch information
albertosouza committed Jan 13, 2017
1 parent d6bd998 commit 3a8d7f1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Database/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,18 @@ function Database (we) {
getLink: function getLink (req) {
if (!req) throw new Error('Request is required in record.getLink()');
return req.we.config.hostname + this.getPath(req);
},
/**
* Get record model name
*
* @return {String}
*/
getModelName() {
if (this.$Model) {
return this.$Model.name;
} else {
return this.$modelOptions.name.singular;
}
}
}
}
Expand Down

0 comments on commit 3a8d7f1

Please sign in to comment.