Re: Accessing join table attributes.

2007-03-29 Thread DJ Spark
Hi Alexandre, Usually, the best way is setting up an Intermediary model, like in your example, Membership, and change your associations to : User -> hasMany -> Membership and Group -> hasMany -> Membership and don' t forget Membership -> belongsTo -> User Membership -> belongsTo ->

Re: Accessing join table attributes.

2007-03-29 Thread Sonic Baker
Hi Orz, There is a way but I wouldn't call it elegant. You basically have to add an id field to the table and then bind it on the fly when you want to use it. Look to bindModel() in the API. You would bind it as a hasMany Membership. You'll also have to create a Membership model. Cheers, Sonic

Accessing join table attributes.

2007-03-29 Thread Orz
Greetings, I am having trouble finding an elegant way to access extra attributes in a join table I am using to associate a 'user' model to a 'group' model. The association is of the type hasAndBelongsToMany and I am using a join table called 'memberships' to store relations between the two tables