never mind
Confused about set_relation and set_relation_n_n
Started by K.B., 03 August 2012 - 00:02 AM
- Single Page
Posted 03 August 2012 - 00:02 AM
Posted 25 August 2012 - 01:55 AM
set_relation is used for one to many relation
set_relation_n_n is used for many to many relation.
In this example http://www.grocerycrud.com/documentation/options_functions/set_relation, an office can has several employee (one to many relation) so, we use set_relation in employee form. Therefore, the user can choose in which office the employee assigned to.
In this example http://www.grocerycrud.com/documentation/options_functions/set_relation_n_n, an actor can star many films, and a film can be starred by many actor. So we use set_relation_n_n in film form. Therefore, the user can choose which actors star the film
set_relation_n_n is used for many to many relation.
In this example http://www.grocerycrud.com/documentation/options_functions/set_relation, an office can has several employee (one to many relation) so, we use set_relation in employee form. Therefore, the user can choose in which office the employee assigned to.
In this example http://www.grocerycrud.com/documentation/options_functions/set_relation_n_n, an actor can star many films, and a film can be starred by many actor. So we use set_relation_n_n in film form. Therefore, the user can choose which actors star the film