⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Confused about set_relation and set_relation_n_n



K.B.
  • profile picture
  • Member

Posted 03 August 2012 - 00:02 AM

never mind

goFrendiAsgard
  • profile picture
  • Member

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