From: Nigel Metheringham Date: Fri, 24 Feb 2006 12:11:11 +0000 (+0000) Subject: Minor documentation fix for find. Removed some EOL spacing X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fd9f5466f21101663f7917e477e36e19af77811b;p=dbsrgits%2FDBIx-Class-Historic.git Minor documentation fix for find. Removed some EOL spacing --- diff --git a/lib/DBIx/Class/Relationship/Accessor.pm b/lib/DBIx/Class/Relationship/Accessor.pm index b94f238..c404c32 100644 --- a/lib/DBIx/Class/Relationship/Accessor.pm +++ b/lib/DBIx/Class/Relationship/Accessor.pm @@ -39,7 +39,8 @@ sub add_relationship_accessor { }, deflate => sub { my ($val, $self) = @_; - $self->throw_exception("$val isn't a $f_class") unless $val->isa($f_class); + $self->throw_exception("$val isn't a $f_class") + unless $val->isa($self->result_source->schema->class($f_class)); return ($val->_ident_values)[0]; # WARNING: probably breaks for multi-pri sometimes. FIXME } diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 5d6f601..216b0c7 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -186,7 +186,7 @@ Pass a literal chunk of SQL to be added to the conditional part of the resultset. =cut - + sub search_literal { my ($self, $cond, @vals) = @_; my $attrs = (ref $vals[$#vals] eq 'HASH' ? { %{ pop(@vals) } } : {}); @@ -205,7 +205,7 @@ Finds a row based on its primary key or unique constraint. For example: Also takes an optional C attribute, to search by a specific key or unique constraint. For example: - my $cd = $schema->resultset('CD')->find_or_create( + my $cd = $schema->resultset('CD')->find( { artist => 'Massive Attack', title => 'Mezzanine', @@ -638,8 +638,8 @@ sub create { $class->find_or_create({ key => $val, ... }); -Searches for a record matching the search condition; if it doesn't find one, -creates one and returns that instead. +Searches for a record matching the search condition; if it doesn't find one, +creates one and returns that instead. my $cd = $schema->resultset('CD')->find_or_create({ cdid => 5, @@ -974,7 +974,7 @@ then search against all mothers of those children: ] ], { 'mother.person_id' => 'child.mother_id' } - ], + ], ] }, );