I have tested it now, and this works very well. Thanks for your help on this matter.
-----Original Message----- From: [email protected] [mailto:[email protected]] Sent: 14 September 2011 17:22 To: [email protected] Subject: RE: [Catalyst] RE: DBIC <-> JSON conversion for AJAX That's because you didn't do exactly what I suggested. :) You rolled up the creation of an array and the assignment into one, in doing so you called the search()->all in a scalar context, which will of course give you the number of rows. If you really want to do that I think the following should work (not tested) sub thing_GET { my ($self, $c) = @_; $self->status_ok( $c, entity => [$c->model('DB::data)->search({},{result_class => 'DBIx::Class::ResultClass::HashRefInflator',})->all ], ); } -----Original Message----- From: Roland Philibert [mailto:[email protected]] Sent: 14 September 2011 16:44 To: The elegant MVC web framework Subject: RE: [Catalyst] RE: DBIC <-> JSON conversion for AJAX I did try what you suggest as per: sub thing_GET { my ($self, $c) = @_; $self->status_ok( $c, entity => $rs = $c->model('DB::data)->search({},{result_class => 'DBIx::Class::ResultClass::HashRefInflator',})->all ); } ...but the json rest object was showing just the number of row retrieved ie: {"rest":80} -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: 14 September 2011 16:13 To: [email protected] Subject: RE: [Catalyst] RE: DBIC <-> JSON conversion for AJAX search calls ->all() implicitly on the resultset in list context so the following should work. sub thing_GET { my ($self, $c) = @_; my @arr = $c->model('DB::data)->search({}, { result_class => 'DBIx::Class::ResultClass::HashRefInflator', }); $self->status_ok( $c, entity => \@arr ); } This e-mail (including any attachments) is confidential, may contain proprietary or privileged information and is intended for the named recipient(s) only. Unintended recipients are prohibited from taking action on the basis of information in this e-mail and must delete all copies. Nomura will not accept responsibility or liability for the accuracy or completeness of, or the presence of any virus or disabling code in, this e-mail. If verification is sought please request a hard copy. Any reference to the terms of executed transactions should be treated as preliminary only and subject to formal written confirmation by Nomura. Nomura reserves the right to monitor e-mail communications through its networks (in accordance with applicable laws). No confidentiality or privilege is waived or lost by Nomura by any mistransmission of this e-mail. Any reference to "Nomura" is a reference to any entity in the Nomura Holdings, Inc. group. Please read our Electronic Communications Legal Notice which forms part of this e-mail: http://www.Nomura.com/email_disclaimer.htm _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/ Aptina (UK) Limited, Century Court, Millennium Way, Bracknell, Berkshire, RG12 2XT. Registered in England No. 06570543. This e-mail and any attachments contain confidential information and are solely for the review and use of the intended recipient. If you have received this e-mail in error, please notify the sender and destroy this e-mail and any copies. _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
