[Jifty-commit] r4032 - jifty/trunk/lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun Sep 2 19:47:59 EDT 2007


Author: ruz
Date: Sun Sep  2 19:47:58 2007
New Revision: 4032

Modified:
   jifty/trunk/lib/Jifty/ClassLoader.pm

Log:
* don't gen a collection class if there is no model

Modified: jifty/trunk/lib/Jifty/ClassLoader.pm
==============================================================================
--- jifty/trunk/lib/Jifty/ClassLoader.pm	(original)
+++ jifty/trunk/lib/Jifty/ClassLoader.pm	Sun Sep  2 19:47:58 2007
@@ -180,10 +180,15 @@
     
     # Autogenerate the Collection class for a Model
     elsif ( $module =~ /^(?:$base)::Model::([^\.]+)Collection$/ ) {
+        my $modelclass = $base .'::Model::'. $1;
+        unless ( $modelclass->isa('Jifty::Record') ) {
+            warn "There is no model for $module";
+            return undef;
+        }
         return $self->return_class(
                   "package $module;\n"
                 . "use base qw/@{[$base]}::Collection/;\n"
-                . "sub record_class { '@{[$base]}::Model::$1' }\n"
+                . "sub record_class { '$modelclass' }\n"
                 . "sub _autogenerated { 1 };\n"
             );
     } 


More information about the Jifty-commit mailing list