[Dbix-class] doing a search

Jess Robinson castaway at desert-island.demon.co.uk
Sat Jan 20 12:33:10 GMT 2007



On Fri, 19 Jan 2007, Octavian Rasnita wrote:

> From: "Nilson Santos Figueiredo Junior" <acid06 at gmail.com>
>
>>  You've probably set up a relationship called "id_role" and thus it's
>>  getting called instead of the "id_role" field accessor. Try changing
>>  the name of this relationship.
>
> Oh yes, that was the problem.
>
> Can you tell me in which cases are the relations "belongs_to" needed?
> I have seen that the authorization works even if I comment them out. I think 
> they are not required for the authorization, and I don't know if I should 
> keep them or not.
>

Instead of changing the relationships, you can also still get at the 
original data, by using get_column. In your example beore, 
$role->get_column('id_role') should output what you wanted. (Or 
$role->id_role->id)

Jess




More information about the Dbix-class mailing list