small fix to ResultSetManager
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSetManager.pm
index 9989b2e..c8e3bd6 100644 (file)
@@ -9,9 +9,12 @@ __PACKAGE__->table_resultset_class_suffix('::_resultset');
 
 sub table {
     my ($self,@rest) = @_;
-    $self->next::method(@rest);
-    $self->_register_attributes;
-    $self->_register_resultset_class;
+    my $ret = $self->next::method(@rest);
+    if (@rest) {
+        $self->_register_attributes;
+        $self->_register_resultset_class;        
+    }
+    return $ret;
 }
 
 sub load_resultset_components {
@@ -28,10 +31,10 @@ sub _register_attributes {
     foreach my $meth (@{Class::Inspector->methods($self) || []}) {
         my $attrs = $cache->{$self->can($meth)};
         next unless $attrs;
-        if ($attrs->[0] eq 'resultset') {
+        if ($attrs->[0] eq 'ResultSet') {
             no strict 'refs';
             my $resultset_class = $self->_setup_resultset_class;
-            *{"$resultset_class\::$meth"} = *{"$self\::$meth"};
+            *{"$resultset_class\::$meth"} = $self->can($meth);
             undef *{"$self\::$meth"};
         }
     }
@@ -79,7 +82,7 @@ __END__
 
 This package implements two useful features for customizing resultset classes.
 C<load_resultset_components> loads components in addition to C<DBIx::Class::ResultSet>
-(or whatever you set as C<base_resultset_class>). Any methods tagged with the C<resultset>
+(or whatever you set as C<base_resultset_class>). Any methods tagged with the C<ResultSet>
 attribute will be moved into a table-specific resultset class (by default called
 C<Class::_resultset>).