You want to do..

 

$person->affiliation_id-> affiliation_id

 

From: jagdish eashwar [mailto:[email protected]] 
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 <[email protected]> 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: [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/

 

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

Reply via email to