First off, I think you need to name things correctly. In users, you should
have country_id, and your table should be named countries.
Next, just add the following to the Country model:
var $hasMany = array(
'User' =>
array('className' => 'User',
),
);
And in the User model:
var $belongsTo = array(
'Country' =>
array('className' => 'Country',
),
);
Set $this->User->recursive = 1; before you query the users table, and you
should be all set!
Also, as good as the IBM tutorials are, you should really read
http://manual.cakephp.org/ thoroughly. Tons of great information there.
HTH,
Eric
On 2/22/07, josoroma <[EMAIL PROTECTED]> wrote:
>
> I was learning cake with the IBM tutorials, and everything is working
> nice, is a piece of art, a piece of cake.
>
> My question, what can i have to add an use in: model, controller and
> view to add a select of Country in a user table? Cuz, a user can edit
> the information later, how to show the country name and not the
> country number, how do i manage this.
>
> table users:
> id
> username
> password
> countrys_id -> do i have to use inflections?
>
> table countrys: -> do i have to use inflections?
> id
> name
>
>
>
>
http://www-128.ibm.com/developerworks/views/opensource/libraryview.jsp?search_by=cook+web+sites+CakePHP
>
> Thanks in advanced.
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---