]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole/Model/CDBI/FromCGI.pm
reorganised model inheritance, new test
[maypole.git] / lib / Maypole / Model / CDBI / FromCGI.pm
index 9baaf9efe916c3117a44b60ae7cc0ffb7781ccad..e01fb9e89312a33fbb14f5abb3567b591caf847c 100644 (file)
@@ -1,4 +1,5 @@
 package Maypole::Model::CDBI::FromCGI;
+use Class::C3;
 use strict;
 use warnings;
 
@@ -18,7 +19,7 @@ Maypole::Model:CDBI::FromCGI - Validate form input and populate Model objects
 
   $obj = $obj->add_to_from_cgi($r);
   $obj = $obj->add_to_from_cgi($r, { params => {...} } );
-  
+
   # This does not work like in CDBI::FromCGI and probably never will :
   # $class->update_from_cgi($h, @columns);
 
@@ -101,8 +102,6 @@ Returns errors that ocurred during an operation.
 
 sub cgi_update_errors { %{ shift->{_cgi_update_error} || {} } }
 
-
-
 =head2 create_from_cgi
 
 Based on the same method in Class::DBI::FromCGI.
@@ -279,12 +278,9 @@ sub validate_all {
   my $updating   = $opts->{updating};
 
   # Base case - validate this classes data
-  $opts->{all}   ||= eval{ $r->config->{$self->table}{all_cols} }              ||
-    [$self->columns('All')];
-  $opts->{required} ||= eval{ $r->config->{$self->table}{required_cols} } ||   
-       [];
-  my $ignore = $opts->{ignore} || eval{ $r->config->{$self->table}{ignore_cols} }      
-    || [];
+  $opts->{all}   ||= eval{ $r->config->{$self->table}{all_cols} } || [$self->columns('All')];
+  $opts->{required} ||= eval { $r->config->{$self->table}{required_cols} || $self->required_columns } || [];
+  my $ignore = $opts->{ignore} || eval{ $r->config->{$self->table}{ignore_cols} } || [];
   push @$ignore, $self->primary_column->name if $updating;
   
   # Ignore hashes of foreign inputs. This takes care of required has_a's