[Dbix-class] DynamicSubclass and Preview: conflict?

Peter Rabbitson rabbit+dbic at rabbit.us
Thu Apr 29 22:09:39 GMT 2010


Miquel Ruiz wrote:
> Hi everybody,
> 
> I'm having some problems using together (in the same result class) the
> DynamicSubclass and Preview components. Maybe someone can point out
> what's going on (and maybe someone can point out how to solve it :)).
> 
> I have a result class Item, with three subclasses: Service, Component
> and Bundle. In the parent class, i need to use the Preview component, as
> follows:
> 
> ###########################################
> 
> package MyApp::Schema::Items;
> 
> use base qw/DBIx::Class/;
> 
> __PACKAGE__->load_components(qw/
>     Preview DynamicSubclass Core
> /);
> 
> __PACKAGE__->table('items');
> 
> __PACKAGE__->typecast_map( item_type => {
>     SERVICE   => 'MyApp::Schema::Items::Service',
>     COMPONENT => 'MyApp::Schema::Items::Component',
>     BUNDLE    => 'MyApp::Schema::Items::Bundle',
> });
> 
> ...
> 
> ##############################################
> 
> The error appears when doing, with preview_schema activated:
> 
> $c->model('MyApp::Schema::Items')->create(\%item_stuff);
> 
> returning the following error:
> 
> DBIx::Class::ResultSet::create(): No such column 'deleted' at ...
> 

Have you actually followed the setup steps as described in the
manual [1]? This is something you got to do manually, Preview
will not do it for you.

[1] http://search.cpan.org/~lsaunders/DBIx-Class-Preview-1.000002/lib/DBIx/Class/Preview.pm#SETUP



More information about the DBIx-Class mailing list