in reply to Re: Can't retrieve data in a catalyst controller
in thread Can't retrieve data in a catalyst controller

Ok so one question I have is in the template why did it matter when the for loop was called as [% FOR user IN users_rs.all -%] I'm just trying to understand why it had to be 'user' when I am not setting anything like this in my code. I am trying to understand so I will know for future reference. I can't seem to find a good answer to this anywhere

Replies are listed 'Best First'.
Re^3: Can't retrieve data in a catalyst controller
by ikegami (Patriarch) on Apr 13, 2011 at 04:43 UTC

    It doesn't have to be $user.

    FOR user IN users_rs.all
    is like
    for my $user (users_rs->all)
Re^3: Can't retrieve data in a catalyst controller
by Your Mother (Archbishop) on Apr 13, 2011 at 13:46 UTC

    What ikegami said, plus make sure to read your original code–

    [% FOR tech IN users.all -%] <tr> <td>[% users.id %]</td>

    The problem is you called each object in the resultset tech but tried to access it as users. This would be fine too–

    [% FOR tech IN users.all -%] <tr> <td>[% tech.id %]</td>

    I was joking above about keeping it consistent (always calling them user) because it has led to confusion a couple of times, not that tech is somehow wrong.