added search_related_rs at resultset
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSet.pm
index b30efa2..3f2ee30 100644 (file)
@@ -496,6 +496,17 @@ sub search_related {
   return shift->related_resultset(shift)->search(@_);
 }
 
+=head2 search_related_rs
+
+This method works exactly the same as search_related, except that
+it garauntees a restultset, even in list context.
+
+=cut
+
+sub search_related_rs {
+  return shift->related_resultset(shift)->search_rs(@_);
+}
+
 =head2 cursor
 
 =over 4
@@ -2132,7 +2143,7 @@ See L<DBIx::Class::Schema/throw_exception> for details.
 
 sub throw_exception {
   my $self=shift;
-  if (ref $self) {
+  if (ref $self && $self->_source_handle->schema) {
     $self->_source_handle->schema->throw_exception(@_)
   } else {
     croak(@_);