didit-tech/FastLegS — pull request #31 by toots (2012-01-26 01:47:11+00:00)
Title: Improved many-to-many support.

This PR provides an enhanced many-to-many support. It works that way:

Foo = FastLegS.Base.extend
tableName : "foos"
primaryKey : "id"

FooBar = FastLegS.Base.extend
tableName : "foos_bars

Bar = FastLegS.Base.extend
tableName : "bars"
primaryKey : "id"
many : [ {
Foo : Twitter,
assoc :
model : FooBar
key : "foo_id"
joinOn : "bar_id"
} ]

The old `joinOn : "foo.bar_id"` is dropped.

Also. `includes.join` is changed. It is now:

Foo.find { id : id }, {
includes : {
join : {
model : Bar
key : "foo_id"
}
}
}, ...