[Jifty-commit] r1878 - jifty/trunk/lib/Jifty/Action

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Aug 30 12:26:43 EDT 2006


Author: nelhage
Date: Wed Aug 30 12:26:39 2006
New Revision: 1878

Modified:
   jifty/trunk/lib/Jifty/Action/Record.pm

Log:
Make admin mode DTRT with columns that end in _id and refer to another
model.


Modified: jifty/trunk/lib/Jifty/Action/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record.pm	(original)
+++ jifty/trunk/lib/Jifty/Action/Record.pm	Wed Aug 30 12:26:39 2006
@@ -146,9 +146,14 @@
                 $info->{default_value} = $current_value if $self->record->id;
             }
 
-	    ##################
-	    my $render_as = $column->render_as;
-	    $render_as = defined $render_as ? lc($render_as) : '';
+            # 
+            if($field =~ /^(.*)_id$/ && $self->record->column($1)) {
+                $column = $self->record->column($1);
+            }
+
+            ##################
+            my $render_as = $column->render_as;
+            $render_as = defined $render_as ? lc($render_as) : '';
 
             if ( defined (my $valid_values = $column->valid_values)) {
                 $info->{valid_values} = [ @$valid_values ];
@@ -291,7 +296,7 @@
 sub take_action {
     my $self = shift;
     $self->log->fatal(
-        "Use one of the Jifty::Action::Record subclasses, ::Create, ::Update or ::Delete"
+        "Use one of the Jifty::Action::Record subclasses, ::Create, ::Update or ::Delete or ::Search"
     );
 }
 


More information about the Jifty-commit mailing list