[Catalyst] Catalyst DBIX stash, getting at the data
Francisco Obispo
fobispo at isc.org
Mon Oct 15 19:40:47 GMT 2012
You don't need to store the data in $c->session.
if you're using Catalyst::View::TT, you just be able to:
$c->stash->{project}=$c->model('DB::Project')->find($project_id);
and then in your view:
<h3>[% project.project_name %]</h3>
regards
On Oct 15, 2012, at 12:28 PM, Tadhg <tadhg.daley at gmail.com> wrote:
> Catalyst Controller Code:
> sub Project :Local {
> my ($self, $c, $project_id) = @_;
>
> $c->stash(projects => [$c->model('DB::Project')->find({'Project_id', $project_id })]);
> die "App $project_id not found!" if !$c->stash->{projects}; # This all works fine
>
> # This is a guess and doesn't work ;-)
> $c->session{Project} => $c->stash->{projects}->project_name;
> # Where project_name is an accessor in the DBIx result set.
> }
>
Francisco Obispo
Director of Applications and Services - ISC
email: fobispo at isc.org
Phone: +1 650 423 1374 || INOC-DBA *3557* NOC
PGP KeyID = B38DB1BE
More information about the Catalyst
mailing list