Extracted at 2009-10-25.
pike.ida.liu.se
[Top]
Fins
Fins.Model
Fins.Model.DataObject

Method Fins.Model.DataObject()->belongs_to()


Method belongs_to

void belongs_to(.DataModelContext context, string other_type, string|void my_name, string|void my_field)

Description

define a one to one relationship in which the local object has a field which contains the id of instance of another data type. the reverse relationship can be defined in the other datatype using has_many .

Parameter other_type

the data type name (not the table name) of the type the field references.

Parameter my_name

an optional attribute used to specify the name the object will be available as in the current object. The default, if not specified, is the name of the other type.

Parameter my_field

an optional attribute that specifies the field in the table of the local datatype. if not specified, this defaults to the singular inflection of the other datatype, and the database field name of the other data type's primary key, separated by an underscore.