For reference, the conventions you are missing are:

table names are plural - use 'people' and 'positions'
'id' as primary key for all tables
'foreign_id' for foreign keys - so your 'person.position' field should
be 'people.position_id'

With these changes your models would just be:

class Person extends AppModel {
        var $name = 'Person';
        var $belongsTo = array(
                'Position' => array('className' => 'Position')
        );
}

class Position extends AppModel {
        var $name = 'Position';
        var $hasMany = array(
                'Person' => array('className' => 'Person')
        );
}


On Nov 29, 2:31 pm, powtac <[EMAIL PROTECTED]> wrote:
> On Nov 29, 5:18 am, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > 1.  Follow the cake conventions - it makes life easier 
> > (http://manual.cakephp.org/appendix/conventions).
>
> Ok, Ill have a look at it.
>
> > 2.  In your example above, you want:
> > Person belongsTo Position, with foreign_id 'position'
> > Position hasMany Person, with foreign_id 'position'
>
> Thanks for clear short answer!
>
> > 3.  Make sure you are using scaffold for your controller to see these
> > association changes reflected in your views.
>
> I will for sure...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to