[Catalyst] Getting hashref instead of value

Alexander Hartmaier alexander.hartmaier at t-systems.at
Tue May 8 15:33:50 GMT 2012


Am 2012-05-08 17:25, schrieb Ari Constancio:
> On Tue, May 8, 2012 at 4:13 PM, Kenneth S Mclane <ksmclane at us.ibm.com> wrote:
>> My template that cretaes the uri:
>>
>> <td><a href="[% c.uri_for('/accountdetails/detail/') %][% account.account_id
>> %]">[% account.account_code %]</a></td>
>>
>> If someone could point me in the right direction, Ive been fighting this for
>> days.
> Hi Kenneth,
>
> I suppose you mean to use
>
> [% c.uri_for('/accountdetails/detail/', account.account_id) %]
>
> instead of
>
> [% c.uri_for('/accountdetails/detail/') %][% account.account_id %]
No he doesn't because he isn't using Chained but Local where the
dispatcher knows nothing about the number of args.

I assume that you have defined a relationship on the account_id column
without giving it a different name. This makes DBIx::Class inflate the
related row into an object.
Two solutions:
- use a different accessors for your relationships (that's what I'm doing)
- use acount.get_column('account_id') when you can to get the column
value instead of the related row

Also note that it's a common problem that Template Toolkit calls
everything in list context.
search_rs was added to DBIx::Class to make sure you always get a
resultset object and not a list of row objects.
>
> Regards,


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*



More information about the Catalyst mailing list