in reply to Can't retrieve data in a catalyst controller
This is a little fishy–
my ($users) = $c->model('DB::Tech')->search_rs; # No parens necessary or desired, it returns just a ResultSet. my $users = $c->model('DB::Tech')->search_rs;
–but it won’t cause a problem either way.
Debugging / general pointers–
New controller method (PathPart is fine to be explicit but it is redundant here because it’s the same as the method name; and the template setting might even be superfluous)–
sub list :Chained('base') :Args(0) { my ( $self, $c ) = @_; $c->stash(template => 'admin/list.tt2'); } # OR this is likely to work if your TT stuff is configured right- sub list :Chained('base') :Args(0) {}
Now the template. Compare the var names in the loop below to your version. users_rs is already in the stash from chaining off of admin/base. You might want to stop referring to them as techs. It does seem to cause some problems. :)
[% META title = 'System Users List' -%] <table> <tr><th>ID</th><th>firstname</th><th>lastname</th><th>email</th><th>ph +one</th><th>Management Rating</th><th>Comments</th><th>Date</th><th>A +dmin</th></tr> [% FOR user IN users_rs.all -%] <tr> <td>[% user.id %]</td> <td>[% user.firstname | html %]</td> <td>[% user.lastname | html %]</td> <td>[% user.phone | html %]</td> <td>[% user.email | html %]</td> <td>[% user.phone | html %]</td> <td>[% user.managementrating | html %]</td> <td>[% user.managementcomments | html %]</td> <td>[% user.date %]</td> <td>[% user.ismanagement %]</td> </tr> [% END -%] </table>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can't retrieve data in a catalyst controller
by vendion (Scribe) on Mar 30, 2011 at 19:16 UTC | |
|
Re^2: Can't retrieve data in a catalyst controller
by vendion (Scribe) on Apr 13, 2011 at 02:21 UTC | |
by ikegami (Patriarch) on Apr 13, 2011 at 04:43 UTC | |
by Your Mother (Archbishop) on Apr 13, 2011 at 13:46 UTC |