[Catalyst] Database contents not displayed after hitting page refresh

Matt S Trout dbix-class at trout.me.uk
Wed Sep 3 10:57:14 BST 2008

On Wed, Sep 03, 2008 at 09:04:23AM +0200, Emmanuel Quevillon wrote:
> You need to perform a search in your 'ShowData' function to get data
> returned by the Resultset of your model 'Ttrack::Ttrack'.
> At this time, $data is only a resultset object without any data in it.
> Replace :
> my $data = $c->model('Ttrack::Ttrack');
> with
> my $data = $c->model('Ttrack::Ttrack')->search();

No, don't do that.

Those two lines are exactly equivalent except that ->search will cause
a completely pointless clone of the resultset.

$c->model('Ttrack::Ttrack') is -already- a resultset for the whole table.

That's why there's something in there to search on.

      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/

More information about the Catalyst mailing list