[Catalyst] Database contents not displayed after hitting pagerefresh

SHARATH GOPINATH RAO, Chennai sharath.g at hcl.in
Wed Sep 3 11:33:27 BST 2008


Matt: "So it works on the first request but not on the second?"

Yes, it works on the first request and not on second. But, after
changing it to this: $data = $c->model('Ttrack::Ttrack')->search();
it's working fine, although any more suggestions are welcome.

Thanks

-----Original Message-----
From: Matt S Trout [mailto:dbix-class at trout.me.uk] 
Sent: Wednesday, September 03, 2008 3:27 PM
To: tuco at pasteur.fr; The elegant MVC web framework
Subject: Re: [Catalyst] Database contents not displayed after hitting
pagerefresh

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/

_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive:
http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have 
received this email in error please delete it and notify the sender immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------



More information about the Catalyst mailing list