Hey,

I think what you want to show is $role['ParentRole']['name'] instead of
$role['Role']['name']

atenciosamente,
Werner Petry Moraes
[email protected]


On Mon, Aug 22, 2011 at 21:54, Rodrigo Vronscki Ricardo
<[email protected]>wrote:

> Hi there,
>
> I'm new to Cakephp and I'm trying to build a small system wich Users have
> Roles and Roles MAY have a parent Role
>
> So I tried to change the name of the model to parentRole like below:
>
> var $belongsTo = array(
> 'parentRole' => array(
> 'className' => 'Role',
>  'foreignKey' => 'role_id'
>
> In database, everything is ok, showing a Manager has a parent Superadmin,
> but it doesn't seem to fetch the correct name for the parentRole in
> roles/index.
>
> I also tried changing:
> <?php echo $this->Html->link($role['Role']['name'], array('controller' =>
> 'roles', 'action' => 'view', $role['Role']['id'])); ?>
> To:
> <?php echo $this->Html->link($role['Role']['name'], array('controller' =>
> 'roles', 'action' => 'view', $role['Role']['role_id'])); ?>
> But made no difference.
>
> I know it should be something simple, but can't find a solution.
> Is there anything to change in controller? Anyone could help me?
>
> Regards,
>
> Rodrigo
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to