[Catalyst] still not sure if I have the hang of this ...
Joe Landman
landman at scalableinformatics.com
Wed Dec 28 21:02:21 CET 2005
test::Model::Database::Testing->find_or_create works
$c->model('Testing')->find_or_create fails (Caught exception "Can't
call method "find_or_create" on an undefined value at
/root/test/script/../lib/test/Controller/db.pm line 24.")
$c->model('Database::Testing)->find_or_create works.
Hmmm... must have built the model wrong. This is what I used
script/test_create.pl model Database DBIC dbi:SQLite:/root/test/db/test.db
Should that be
script/test_create.pl model DBIC dbi:SQLite:/root/test/db/test.db
??
Joe
Matt S Trout wrote:
> On Tue, Dec 27, 2005 at 11:43:43PM +0100, Andreas Marienborg wrote:
>>> Now I want to take this data and stuff it into one of my model's
>>> tables. I presume it is something like
>>>
>>> __PACKAGE__->find_or_create({ key1 => $value1, key2 =>
>>> $value2, ...} );
>>>
>> You usually have to replace __PACKAGE__ with the actual model-
>> package, like MyApp::Model::Table->find_or_create
>
> Aieee, don't do that!
>
> $c->model('Table') is better because that way you can move that controller
> code into another app without having to trudge through a search-and-replace.
>
--
Joseph Landman, Ph.D
Founder and CEO
Scalable Informatics LLC,
email: landman at scalableinformatics.com
web : http://www.scalableinformatics.com
phone: +1 734 786 8423
fax : +1 734 786 8452
cell : +1 734 612 4615
More information about the Catalyst
mailing list