[Catalyst] Re: Template creates objects via belongs_to autovivification

Matt Rosin mattrosin at yahoo.com
Wed Jun 13 13:36:40 GMT 2007

P.S. The TT code that causes Customer records to be created in the database by autovivification is the statement "r.customer.b_company" below:

[% FOREACH r = Catalyst.stash.transactions %]
[% TRY %][% r.customer.b_company %][% CATCH %]Not defined[% END %]
[% END %]

I can confirm that the words "Not defined" show up for 4 records on page 1 of results, which matches the 4 blank customer records. Putting a comment ("#") just before the letter r stops the autovivification.

Unfortunately I cannot seem to solve it in TT though. "r.customer.defined" or "r.customer.b_company.defined" still autovivify I think, r.customer tests as > 0 even if not (since it is a structure I guess), and checking r.customer.id also is useless. Also the description of might_have does not sound like it will help, and could hurt my app. How to solve this, aside from using get_column in the perl code (which I have done to solve other problems).


Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.

More information about the Catalyst mailing list