class method ActiveRecord.Model.hasMany
ActiveRecord.Model.hasMany(related_model_name[,options]) → null
Sepcifies a 1->N relationship between models. The foreign key will reside in the child (related) object. - related_model_name (String): Can be a plural or singular referring to the related table, the model name, or a reference to the model itself ("users","User" or User would all work). - options (Object)
Options can contain:
- foreignKey (String)
- name (String)
- dependent (Boolean)
- order (String)
- where (String)
User.hasMany('comments',{
dependent: true
});
var u = User.find(5);
//each User instance will gain the following 5 methods
u.createComment()
u.buildComment()
u.destroyComment()
u.getCommentList() //takes the same options as find()
u.getCommentCount() //takes the same options as count()


