My mistake in typing.

User hasOne Profile, Profile belong to User, Profile hasOne State, State
belongsTo Profile

User makes a Post where it puts some info from the his Users Profile (his
name city and the state) But on his profile it's the full word California,
in the post I would like CA so Pomona,CA rather than Pomona California.

Dave



-----Original Message-----
From: Marcel [mailto:[email protected]] 
Sent: April-12-09 7:09 PM
To: [email protected]
Subject: Re: Value from record


Dave Maharaj :: WidePixels.com wrote:
> I have a states table which holds id, abrev, name
>  
> My user profile displays the State.name based on the id. (HABTM table)
>  
> <?php echo $user['User']['state_id']; ?> displays California
>  
> How can i get it to display CA rather than the full name?
>  
> the controller gets the user info by:
> $this->set('users', $this->paginate());
>  
> Thanks,
>  
> Dave


Why HABTM?

Shouldn't it be sth like: User hasOne State, State belongsTo User? It should
be enough to just have a state_id at your user table.


Marcel




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