[Catalyst] Jason Kohles' tutorial on ExtJs editable data gridsandCatalyst

Scott Pham (scpham) scpham at cisco.com
Fri May 1 15:31:04 GMT 2009


You want to do..

 

$person->affiliation_id-> affiliation_id

 

From: jagdish eashwar [mailto:jagdish.eashwar at gmail.com] 
Sent: Friday, May 01, 2009 11:21 AM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Jason Kohles' tutorial on ExtJs editable data
gridsandCatalyst

 

Thanks, Adam. With the debug line in the code, for
$person->affiliation_id, I get 

[debug] Whats this -
AdventAjaxGrid2::Model::AdventAjaxGrid2DB::Affiliation=HASH(0xad06b00)
[debug] Whats this -
AdventAjaxGrid2::Model::AdventAjaxGrid2DB::Affiliation=HASH(0xad06a60)
[debug] Whats this -
AdventAjaxGrid2::Model::AdventAjaxGrid2DB::Affiliation=HASH(0xacff1e8)
[debug] Whats this -
AdventAjaxGrid2::Model::AdventAjaxGrid2DB::Affiliation=HASH(0xacff188)
[debug] Whats this -
AdventAjaxGrid2::Model::AdventAjaxGrid2DB::Affiliation=HASH(0xacff118)

If I change the debug line to get  $person->name, it gives me the
following nicely:

[debug] Whats this - Jagdish Eashwar
[debug] Whats this - Sushama Marathe
[debug] Whats this - Manasi Jagdish
[debug] Whats this - Ninad Jagdish
[debug] Whats this - Muttsy

The name column has no belongs_to relationship, but the affiliation_id
column has. That must be making the difference.



On Fri, May 1, 2009 at 4:16 PM, Adam Witney <awitney at sgul.ac.uk> wrote:

	
	sub people_data : Local {
	     my ( $self, $c ) = @_;
	
	     my $rs = $c->model( 'AdventAjaxGrid2DB::People' );
	     my @people = ();
	     while ( my $person = $rs->next ) {
	         push( @people, {
	             id          => $person->id,
	             name        => $person->name,
	             affiliation_id => $person->affiliation_id,

 

I would guess that this line is returning an Affiliation object rather
than the affiliation_id then? You could test it by adding this line
after the push

$c->log->debug('Whats this - '.$person->affiliation_id."\n");

if so then you would have to look at your Model.

Maybe someone with more experience could tell you the likely reason for
this?



HTH

adam

_______________________________________________
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/

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090501/8e04fedc/attachment.htm


More information about the Catalyst mailing list