From: Rob Kinyon Date: Wed, 11 Nov 2009 13:50:51 +0000 (-0500) Subject: Changed how the rules are kept up to date with source names and went through 3 CPAN... X-Git-Tag: 1.001011~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=28acb62276c888fadda4898f802a213b8fd8c075;p=dbsrgits%2FDBIx-Class-Fixtures.git Changed how the rules are kept up to date with source names and went through 3 CPAN uploads in the process. I'm a git. --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3268211 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.*.sw? diff --git a/Changes b/Changes index 0d16e98..5c0efcb 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,15 @@ Revision history for DBIx-Class-Fixtures +1.001008 +- Man, I should test better. + +1.001007 +- Should use Schema->source(), not ->resultset(). + +1.001006 +- Schema->resultset() throws an exception, not return undef, when it can't find + a moniker. + 1.001005 - Fixed problem where rules containing an override of has_many weren't applied correctly. diff --git a/lib/DBIx/Class/Fixtures.pm b/lib/DBIx/Class/Fixtures.pm index dab2d3a..974ad06 100644 --- a/lib/DBIx/Class/Fixtures.pm +++ b/lib/DBIx/Class/Fixtures.pm @@ -26,11 +26,11 @@ __PACKAGE__->mk_group_accessors( 'simple' => qw/config_dir =head1 VERSION -Version 1.001005 +Version 1.001008 =cut -our $VERSION = '1.001005'; +our $VERSION = '1.001008'; =head1 NAME @@ -525,8 +525,8 @@ sub dump { my @sources = sort { $a->{class} cmp $b->{class} } @{delete $config->{sets}}; while ( my ($k,$v) = each %{ $config->{rules} } ) { - if ( my $rs = $schema->resultset($k) ) { - $config->{rules}{$rs->result_source->source_name} = $v; + if ( my $source = eval { $schema->source($k) } ) { + $config->{rules}{$source->source_name} = $v; } } diff --git a/t/var/configs/rules.json b/t/var/configs/rules.json index 6d44f93..fb0412d 100644 --- a/t/var/configs/rules.json +++ b/t/var/configs/rules.json @@ -17,6 +17,9 @@ }] }], "rules": { + "might_have": { + "fetch": 0 + }, "CD": { "cond": [{ "tags.tag": "Cheesy" }], "join": ["tags"],