habtm - need some clarification

2009-02-28 Thread Dhana
I have a groups, users and tasks models. Groups has a HABTM to users. Users has a HABTM to groups. Users has many tasks. From the tasks model, I am trying to find out which group the user belongs to. Once I have this information, I plan to put into a session variable so I only need to query

Re: habtm - need some clarification

2009-02-28 Thread mscdex
On Feb 28, 1:30 pm, Dhana sldh...@gmail.com wrote: But, how do I make this query efficiently? One solution would be to use the Containable behavior with the User model. Then you can find what groups the user belongs to by doing a find and including a 'contain' option which is an array

Re: habtm - need some clarification

2009-02-28 Thread Marcelo Andrade
On Sat, Feb 28, 2009 at 3:30 PM, Dhana sldh...@gmail.com wrote: I have a groups, users and tasks models. Groups has a HABTM to users. Users has a HABTM to groups. Users has many tasks. From the tasks model, I am trying to find out which group the user belongs to. Once I have this