Nevermind...the answer was of course quite simple.

The bake function creates something similar to this for all hasMany
associations:

     $comment['state_id'];

Changing the recursion to 2 in the Controller and changing the View to
read:

     $comment['State']['state_id'];

does the trick.

On Jul 4, 12:19 pm, martin_nyc <[EMAIL PROTECTED]> wrote:
> I have a table of all US States. I use this table to associate users,
> posts and comments. Simple enough, but...
>
> I can't figure out how to get other fields out of the States table
> (state name instead of the id field) when I'm associating Posts and
> Comments.
>
> For example:
>
> Post belongsTo State and hasMany comments -> Comment belongsTo State
>
> In the view, for the Comments section, I would like to get the
> state_name field out of my table instead of the default state_id
> field.  How do I go about doing that. Is that done in the Model or
> through a find function in the Controller?
>
> Unless I'm totally wrong (which is possible), HABTM doesn't apply to
> this situation.
>
> Any advice or direction would be much appreciated. Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~
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