[Catalyst] Error loading data from schema

Kenneth S Mclane ksmclane at us.ibm.com
Wed Apr 4 15:07:10 GMT 2012


From:
Francisco Obispo <fobispo at isc.org>
To:
The elegant MVC web framework <catalyst at lists.scsys.co.uk>
Date:
04/04/2012 09:47 AM
Subject:
Re: [Catalyst] Error loading data from schema



The error is because $c->model('dbms::ACCOUNT_VIEW') is not defined.

Did you create the view after creating the model? if so, try re-running 
the create script so it can pick up the changes.

Also, to avoid fatal errors, you should attempt to load the model first, 
and then send to the template a data structure only if it loads properly.



On Apr 4, 2012, at 7:28 AM, Kenneth S Mclane wrote:

> I am getting the following error: Caught exception in 
dbms::Controller::AccountView->list "Can't call method "all" on an 
undefined value at 
/tmp/catalyst/dbms/script/../lib/dbms/Controller/AccountView.pm line 7." 
> 
> this is the referenced sub: 
> 
> sub list : Local { 
>         my ($self, $c) = @_; 
>         $c->stash(accounts => $c->model('dbms::ACCOUNT_VIEW')->all); 
>         $c->stash(template => 'accountview/list.tt2'); 
> } 
> 
> I have seen quite a few posts about this error but no real explanations 
of what is causing the issue.  I created a view in the DB containing the 
data I need to display on the page.  The error is occurring at this line: 
$c->stash(accounts => $c->model('dbms::ACCOUNT_VIEW')->all); which I have 
tried several different things. If I remove the ->all I get no error and 
my header row appears. I cannot find anything that tells me specifically 
what this should be composed of. Any pointers to help figure this out are 
appreciated.
> 
> Regards 
> 

Thanks for the quick response. I did create it after but I also re-ran the 
script and it pulled it in. I found my error, I was using the wrong schema 
name, hence the object didn't exist. Now it is giving me "Couldn't render 
template "accountview/list.tt2: file error - config/main: not found", so I 
need to go track that one down. If I can get this one page working I'll be 
able to create all the pages I need then add auth and CRUD and I'm in 
business.





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


More information about the Catalyst mailing list