[Dbix-class] Base class behavior change from latest release to trunk

J. Shirley jshirley at gmail.com
Tue Nov 18 02:49:58 GMT 2008


I have a schema that I was working on quite some time ago (about 3
months) and has picked up again.  The basics of it are multiple views
of the same table.  I have a common base class, and inherit from that
and then have a method that populates different keys based on the
result source.  To illustrate, imagine this:

package MyApp::Schema::BaseClass;

use Moose;
use parent 'DBIx::Class';

__PACKAGE__->table('foo');
__PACKAGE__->add_columns( result_source => { data_type => 'varchar',
size => 255 } );

before 'insert' => sub {
    my ( $self, $attrs ) = @_;
    $self->rel_source( $self->result_source->source_name );
};


1;

package MyApp::Schema::Foo;

use parent 'MyApp::Schema::BaseClass';

1;

So, now I get records in the same table but distinguished based on
what result source they come from.  This works fine with the latest
CPAN release of DBIC (0.08010) but when I try to run the same code
against trunk I get this exception:

Column rel_source not loaded on Test trying to resolve relationship at
t/schema.t line 39

Is this change of behavior expected, or is this possibly a regression?
 If it's a regression I'll write up a test case and hopefully get to
the bottom of it... if not, could someone clue me in? :)

Thanks,
-J



More information about the DBIx-Class mailing list