[Catalyst] Catalyst Model Issue

gordon at gorste.plus.com gordon at gorste.plus.com
Tue Jul 26 17:51:57 GMT 2011


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

I am using the most up to date version of catalyst, DBIx::Class.  I am
also using it with a MySQL backend.

Is there a setting I need to set so this error messages goes away and
insert records into the database?  Has anyone had similar issues


I raised this issue with the DBIx::Class mailing list and they said:

The fix is to insert this line before you serialize the object:

# to let DBIC automatically pick up the correct schema in the child #
process after Storable freezed/thawed the result objects local

$DBIx::Class::ResultSourceHandle::thaw_schema = $rs->result_source->schema;

I am unsure where to put this in my application.  Has anyone have ideas
how to resolve this

Regards

Gordon





More information about the Catalyst mailing list