[jifty-devel] Jifty::Collection virtual columns in models - a proposed patch

Peter Mottram peter at sysnix.com
Tue Sep 27 12:53:45 EDT 2011

Due to a change made back in 2008...

commit fd989774c974cd0869384c25c0f6bb866377c3ad
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 21 07:43:38 2008 +0000

     * add possible_columns method to Jifty/Action/Record*

... which I've been meaning to hunt down for some time but only now had 
a big enough itch, we ended up losing automatic rendering of virtual 
columns which refer to Jifty::Collections. In the past couple of years 
I've got along by adding params in MyApp::Action::CreateFoo to include 
the virtual column in CRUD views but today I got tired of that and 
started searching for the culprit which ended up being the above change.

I've come up with a very simple change which pulls my lovely virtual 
collection columns back into my CRUD views:

diff --git a/lib/Jifty/Action/Record.pm b/lib/Jifty/Action/Record.pm
index cc5b6a2..b33fc8f 100644
--- a/lib/Jifty/Action/Record.pm
+++ b/lib/Jifty/Action/Record.pm
@@ -536,6 +536,7 @@ sub possible_columns {
      my $self = shift;
      return grep {
+            or UNIVERSAL::isa( $_->refers_to, 'Jifty::Collection' )
              or ( !$_->private and !$_->virtual and !$_->computed and 
$_->type n
      } $self->record->columns;

The full Jifty test suite still passes with this change and I cannot see 
anything that it should break. Any chance this (or something similar) 
might make it into trunk?


More information about the jifty-devel mailing list