[Dbix-class] Catalyst Model Issue

Gordon Stewart gordon at gordonstewart.co.uk
Sun Jul 24 13:17:06 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
/home/gordon/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 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20110724/4cf43b39/attachment.htm


More information about the DBIx-Class mailing list