[Catalyst] putting an object in the stash
Octavian Rasnita
orasnita at gmail.com
Tue Mar 13 13:06:54 GMT 2007
From: "Simon Wilcox" <simonw at digitalcraftsmen.net>
> You will have to iterate over the accessors individually to put them into
> the stash (I think) but you should be able to use DBIC to do most of the
> thinking. Something like (untested):
>
> 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?
Thanks.
Octavian
More information about the Catalyst
mailing list