Tag Archives: HABTM

Ext JS 4 – Many to Many

Ext JS 4 is still in nascent stages so far model associations are concerned.

It currently has rudimentary Has-Many and Belongs-To relationships only.

So what do you do if you have pretty complex model with multiple levels of nested associations which also include Many-to-Many instances.

Work around – Use Has-Many Through relationship aka Ruby on Rails.

For example –

Product has many Categories. Category has many products.

Classic case of Many-to-many.

ROR happily supports it as its an old man in this arena while ExtJs 4 is the new kid on the block.

Work around in Ext JS –

Product has many prod-categories.

Category has many prod-categories.

Prod-category belongs to Product.

Prod-category belongs to Category.

And we are good to go…