i notice you didn't use hasMany or hasOne in your family model.

var $hasMany= array(
        'Widget' => array(
            'className' => 'Widget',
            'foreignKey' => 'family_id',
        )
    );

i assume you have family_id set up as a foreign key in your widget
table. of course your set up may vary.

just to clarify are you trying to save a Family, a widget or both?

On Aug 10, 9:49 pm, azkid <[email protected]> wrote:
> I have a model named Widget, and another named Family.  Widget
> belongsTo Family, and the table associated with Widget has a foreign
> key in it, called id.  This foreign key is non-standard, I know, but
> it is a legacy application with cake spliced in--so I manually set the
> foreign key in the association.  Furthermore, the Family table using
> familyid for its primary key (non-standard again).  I have a select
> pulldown in the add() view for Widget, where all available Familes are
> displayed.  In order to get the select pulldown to display all the
> available families, my controller uses $this->set and find('list') to
> create the appropriate view variables.  I've put the applicable code
> snippets athttp://bin.cakephp.org/view/1167953986
>
> The problem is, that when I save, the data from the select field named
> "Family" doesn't save, since the database is expecting something named
> "id", but $this->data contains something named "Family".  I had
> assumed that defining the foreign key in my belongsTo association
> would have made this all work correctly, but obviously not.  I now do
> not believe that things would work even if the conventions were being
> followed.  Instead, I believe that I am making some kind of
> fundamental mis-assumption about how belongsTo associations are
> handled both when rendering a view and at save time.  Is there
> something obvious that jumps out here to anyone?  Being fairly new to
> cake, I've been scouring the cake google group as well as the cookbook
> for guidance, but am still coming up short.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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