[Bast-commits] r6645 - in DBIx-Class/0.08/branches/mc_fixes:
lib/DBIx/Class t
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Fri Jun 12 07:00:02 GMT 2009
Author: ribasushi
Date: 2009-06-12 07:00:02 +0000 (Fri, 12 Jun 2009)
New Revision: 6645
Modified:
DBIx-Class/0.08/branches/mc_fixes/lib/DBIx/Class/Row.pm
DBIx-Class/0.08/branches/mc_fixes/t/96multi_create.t
Log:
This is not update_or_create - create any non-belongs_to without asking many questions
Modified: DBIx-Class/0.08/branches/mc_fixes/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/branches/mc_fixes/lib/DBIx/Class/Row.pm 2009-06-12 00:06:35 UTC (rev 6644)
+++ DBIx-Class/0.08/branches/mc_fixes/lib/DBIx/Class/Row.pm 2009-06-12 07:00:02 UTC (rev 6645)
@@ -377,7 +377,7 @@
my $re = $self->result_source
->related_source($relname)
->resultset
- ->find_or_create($them);
+ ->create($them);
%{$obj} = %{$re};
MULTICREATE_DEBUG and warn "MC $self new $relname $obj";
}
Modified: DBIx-Class/0.08/branches/mc_fixes/t/96multi_create.t
===================================================================
--- DBIx-Class/0.08/branches/mc_fixes/t/96multi_create.t 2009-06-12 00:06:35 UTC (rev 6644)
+++ DBIx-Class/0.08/branches/mc_fixes/t/96multi_create.t 2009-06-12 07:00:02 UTC (rev 6645)
@@ -6,7 +6,7 @@
use lib qw(t/lib);
use DBICTest;
-plan tests => 93;
+plan tests => 92;
my $schema = DBICTest->init_schema();
@@ -328,7 +328,7 @@
is($newartist2->name, 'Fred 3', 'Created new artist with cds via find_or_create');
}, 'Nested find_or_create');
-lives_ok ( sub {
+throws_ok ( sub {
my $artist2 = $schema->resultset('Artist')->create({
name => 'Fred 4',
cds => [
@@ -344,10 +344,8 @@
},
]
});
+}, qr/title are not unique/, 'Multiple same level has_many create fails with duplicate error');
- is($artist2->in_storage, 1, 'artist with duplicate rels inserted okay');
-}, 'Multiple same level has_many create');
-
lives_ok ( sub {
my $artist = $schema->resultset('Artist')->first;
More information about the Bast-commits
mailing list