[Catalyst] generic db table list

Fernan Aguero fernan at iib.unsam.edu.ar
Fri Jun 2 14:16:22 CEST 2006


+----[ Aran Deltac <aran at arandeltac.com> (01.Jun.2006 23:43):
|
| On 6/1/06, Fernan Aguero <fernan at iib.unsam.edu.ar> wrote:
| >Or ... learning TT along the way.
| >
| >What I want to do: have a generic 'list' action that lists
| >the contents of a database table. I'm planning to use this
| >with more complex queries (not just one table per page) but
| >right now I'm starting with functionality similar to that
| >provided by InstantCRUD to learn along the way.
| >
| >Basically I want to end up with an action and an associated
| >view that for any resultset, will do something like
| >
| ><table>
| >[% FOREACH row in rs.next() %]
| ><tr>
| 
| Instead of this:
| 
| >[% FOREACH column in row %]
| ><td>[% column.value %]</td>
| >[% END %]
| 
| Do this:
| 
| [% FOREACH column IN row.result_source.columns %]
| <td>[% row.get_column(column) %]</td>
| [% END %]

Thanks for the suggestion. This works perfectly!

| This is assuming your are using DBIC.

[rest of message snipped]

|
+----]

I don't know if I'm using DBIC, cause I still haven't
figured out what DBIC stands for ... if it's DBIx::Class,
yes I'm using it. 

Thanks again!

Fernan



More information about the Catalyst mailing list