[Jifty-commit] r6519 - Jifty-DBI/branches/tisql/lib/Jifty/DBI

Jifty commits jifty-commit at lists.jifty.org
Fri Feb 27 12:55:58 EST 2009


Author: ruz
Date: Fri Feb 27 12:55:50 2009
New Revision: 6519

Modified:
   Jifty-DBI/branches/tisql/lib/Jifty/DBI/Schema.pm

Log:
* we should set default ->by on column so later we get proper methods generated

Modified: Jifty-DBI/branches/tisql/lib/Jifty/DBI/Schema.pm
==============================================================================
--- Jifty-DBI/branches/tisql/lib/Jifty/DBI/Schema.pm	(original)
+++ Jifty-DBI/branches/tisql/lib/Jifty/DBI/Schema.pm	Fri Feb 27 12:55:50 2009
@@ -350,6 +350,8 @@
         }
         # A one-to-one or one-to-many relationship is requested
         if ( UNIVERSAL::isa( $refclass, 'Jifty::DBI::Record' ) ) {
+            # Assume we refer to the ID column unless told otherwise
+            $column->by('id') unless $column->by;
 
             my $by = $column->by;
             unless ( $column->type ) {
@@ -398,6 +400,7 @@
                 $from->_init_methods_for_column($virtual_column);
             }
         } elsif ( UNIVERSAL::isa( $refclass, 'Jifty::DBI::Collection' ) ) {
+            $column->by('id') unless $column->by;
             $column->virtual('1');
         } else {
             warn "Error in $from: $refclass neither Record nor Collection. Perhaps it couldn't be loaded?";


More information about the Jifty-commit mailing list