fix ResultSourceProxy::Table for inherited classes (needs testing)
David Kamholz [Thu, 26 Jan 2006 18:14:32 +0000 (18:14 +0000)]
lib/DBIx/Class/ResultSourceProxy/Table.pm

index e8a2da0..4f23097 100644 (file)
@@ -42,16 +42,11 @@ sub table {
   my ($class, $table) = @_;
   return $class->result_source_instance->name unless $table;
   unless (ref $table) {
-    $table = $class->table_class->new(
-      {
+    $table = $class->table_class->new({
+        $class->can('result_source_instance') ? %{$class->result_source_instance} : (),
         name => $table,
         result_class => $class,
-      });
-    if ($class->can('result_source_instance')) {
-      $table->{_columns} = { %{$class->result_source_instance->{_columns}||{}} };
-      $table->{_ordered_columns} =
-        [ @{$class->result_source_instance->{_ordered_columns}||[]} ];
-    }
+    });
   }
   $class->mk_classdata('result_source_instance' => $table);
   if ($class->can('schema_instance')) {