boss_db icon indicating copy to clipboard operation
boss_db copied to clipboard

Make clear the requirement of -belongs_to

Open madtrick opened this issue 12 years ago • 0 comments

After the change entered in https://github.com/evanmiller/boss_db/commit/7c60586e1cdf9370ebab34056c2f46e9d6a011d9 if a module takes part of a has_many relation it's required to include a -belongs_to attribute.

Prior to this commit this would work:

-module(a, [Id]).
-has({bs, many}).

%%%%%

-module(b, [Id,AId]).

But after that commit it's required (or in other case when saving the id of the related a record won't be correct) that the b module has a -belongs_to(a) :

-module(a, [Id]).
-has({bs, many}).

%%%%%

-module(b, [Id,AId]).
-belongs_to(a).

It would be nice if the documentation made this clear.

madtrick avatar Feb 19 '13 17:02 madtrick