[Catalyst] Catalyst Model Issue

Alejandro Imass alejandro.imass at gmail.com
Thu Jul 28 15:16:44 GMT 2011


On Tue, Jul 26, 2011 at 1:51 PM,  <gordon at gorste.plus.com> wrote:
> Hi
>
> When I call create on a result set like the same in the catalyst
> documentation like
>
>               my $book = $c->model('DB::Book')->create({title  => $title,
> rating => $rating });
>
> I get the following error
>
> DBIx::Class::ResultSet::create(): Unable to perform storage-dependent
> operations with a detached result source (source '_unnamed_' is not
> associated with a schema). at
> ./catalyst/test/script/../lib/test/Controller/Books.pm line 56

Did you create the Schema classes yourself? or did you use the
xxxx_create.pl script?

I have found that static creation using the create helper script is
the best solution because it gives you the flexibility to extend the
DBIC model and it's also very easy to upgrade when your DB changes.
The way to use the create script for DBIC is:

script/xxxx_create.pl model [model_name] DBIC::Schema [namespace]
create=static dbi:[sriver]:dbname=data/catmodels.db [user] [pass]


--
Alejandro Imass



More information about the Catalyst mailing list