WanWizard / Datamapper

Maintenance of Datamapper has been transferred to https://github.com/saekort/datamapper in 2012.
27 stars 3 forks source link

Better relationship definition and validation #2

Open WanWizard opened 12 years ago

WanWizard commented 12 years ago

In Datamapper v1.x a relationship definition is required in both models participating in the relation, because depending on the query constructed either one can be used, and in some cases information from both is needed.

Datamapper v2.x needs a new relationship definition system where this is no longer needed, you should be able to define only one side if you never need to access it from the other side.

Also, to eliminate all the current "guessing" code, a relationship definition should contain all information needed to construct the relation, including the name, the destination model class, the relationship type, possiblt through model information, and the location of primary and foreign keys.