javascript - Inheritance in Waterline ORM -


does waterline orm support inheritance? say, have model called businessdocument, , want create new model called salesorder extends businessdocument. so, salesorder should end having attributes of businessdocument plus new attributes. supported waterline?

it looks isn't supported out-of-the-box waterline. see github issue.

one of comments in above issue links sailscast video on youtube (here). in nutshell, video walks through using lodash merge child model base model, so:

basemodel.js

module.exports = {   attributes : {     name : 'string',     age  : 'integer'   },   foo : function () {} } 

childmodel.js

var basemodel = require('/path/to/basemodel')   , _ = require('lodash')  module.exports = _.merge(basemodel, {   attributes : {     birthdate : 'date',     ...   } }) 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -