Skip to content

relationship declaration should accept string as parameter #5

@gabrielfalcao

Description

@gabrielfalcao

When declaring relationships of models, it should be possible to declare strings instead of the object itself. This is useful for when declaring self-relationships.

Example:

var Pipeline = models.declare("Pipeline", function(it, kind) {
    it.has.field("name", kind.string);
    it.has.many("instructions", "BuildInstruction", "pipeline");

    it.validates.uniquenessOf("name");

    it.has.getter('permalink', function(){
        return '/pipeline/' + this.__id__;
    });
});

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions