Re: Quick habtm problem

2010-04-15 Thread Blackbit
How about using WITH in the Judge-Model? Is this a good way to do it? class Judges extends AppModel { var $name = Judge; var $hasAndBelongsToMany = array(MediaSegments = array(with = JudgesMediaSegments)); } On 15 Apr., 02:37, Bryan Paddock bryanpadd...@gmail.com wrote: Ah! Thank you!

Quick habtm problem

2010-04-14 Thread Bryan Paddock
Hey all, Going a bit crazy here I think I need a break from this. Anyways, I have the following tables + relationships Judges MediaSegments (a category that the judge is selected to judge) JudgesMediaSegments (contains judge_id and media_segment_id) How would I find all the judges that belong

Re: Quick habtm problem

2010-04-14 Thread Jeremy Burns
Are you using Containable behaviour? You should be! Try this...(typed without testing - so go easy on me if it's wrong!)... From the MediaSegment controller: $this-MediaSegment-find( 'all', array( 'contain' = array( 'Judge'

Re: Quick habtm problem

2010-04-14 Thread Bryan Paddock
Ah! Thank you! After a while of tinkering with your code I realised I had the $actsAs in the controller and not the model :( Works like a charm. I've modified all of my code now to use containable behaviour. Gone with recursive = -1. On Wed, Apr 14, 2010 at 3:45 PM, Jeremy Burns