Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Model and many to many relationships

$
0
0
Hello, 

I am new to JavascriptMVC.  I would like to model Many to Many relationships, and one to many relationships, where an instance 'belongs' to another instance of a different type.  

I also would like to design a Model relationship so that you can only create an attribute through an Owner model.  For example, a User has to create a Quote, and each Quote will be created with a connection to the User.  I figure this is the easiest way to perform service encapsulation.  

What is the best way to do this? 

One approach I had thought of was using a controller and custom event on the 'owner' Model, to create the instance Model, and then add it to a list in the model.  All of the CRUD operations for the instance model would only be accessible from the Owner.  

Is this the correct implementation? 

Thank you, 

Viewing all articles
Browse latest Browse all 3491

Trending Articles