Learn about designing models with containers in mind.


Containers in Stacklane are an important modeling concept. They creates a strong one-to-many, or parent/child relationship. A container may have many kinds of children, but a child may only have one kind of container/parent. For example, "Account/X" and "Account/Y", but there would never be another parent for "X" besides "Account". The container (parent) is always a Universal type.

Back References

All contained models have a reference back to their container. This method is the same name as the container model, but with a lower case first letter. Given a container named List and contained model named Task, the back reference method would be task.list().

Access Control

Containers are an important access control point. Any roles specifically associated between a user and a container will be in effect for the container and its descendants.

For more information see the document on User Profiles.

Behavior of Unique Values

If a model type within a container defines unique values, then those unique values are local/specific to a given container.

For example, given Blog ▶ Post, where Post has a UID field named "slug". If there are many Blog's, and many Posts within any given Blog, then two Posts may have same UID if they are in separate Blog's.