Bogdan Lucaciu wrote:
On Tuesday 13 March 2007 15:06, Octavian Rasnita wrote:
my $model = $c->model("Database::Table");
foreach my $column (@{$model->columns}) {
   $column =~ s{me\.}{}; # strip the prefix DBIC adds
   $c->stash->{$column} = $obj->$column;
}
I have tried that, but it gave the following error:

Can't locate object method "columns" via package "DBIx::Class::ResultSet

What am I doing wrong?


it's $resultset->result_source->columns


Alternatively, get_columns will return a hash (not a reference!) of the current row.

$c->stash->{obj }= { $row->get_columns };

Note that this hash contains uninflated values, if you want column inflation you'll need to loop.

Matt

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to