File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -292,12 +292,13 @@ func HasMany(name, child string) {
292
292
// This specifies that the Order and Product tables have a "junction" table
293
293
// called `order_lines` that contains the order and product information.
294
294
// The generated model will have a field called `Products` that will
295
- // be an array of type `product. Product`.
295
+ // be an array of type `Product`.
296
296
func ManyToMany (other , tablename string ) {
297
297
if r , ok := relationalModelDefinition (false ); ok {
298
298
field := gorma .NewRelationalFieldDefinition ()
299
299
field .FieldName = inflect .Pluralize (other )
300
300
field .Many2Many = other
301
+ field .Datatype = gorma .Many2Many
301
302
field .Description = "many to many " + r .ModelName + "/" + strings .Title (other )
302
303
field .Parent = r
303
304
r .RelationalFields [field .FieldName ] = field
Original file line number Diff line number Diff line change @@ -48,6 +48,10 @@ const (
48
48
HasMany FieldType = "hasmany"
49
49
// HasManyKey is used internally
50
50
HasManyKey FieldType = "hasmanykey"
51
+ // Many2Many is used internally
52
+ Many2Many FieldType = "many2many"
53
+ // Many2ManyKey is used internally
54
+ Many2ManyKey FieldType = "many2manykey"
51
55
// BelongsTo is used internally
52
56
BelongsTo FieldType = "belongsto"
53
57
)
You can’t perform that action at this time.
0 commit comments