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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun May 27 07:33:51 EDT 2007


Author: gugod
Date: Sun May 27 07:33:49 2007
New Revision: 3305

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

Log:
A move to hand on the rendering of JDBI::Collection columns to app
develoeprs.

We used to just ignore the rendering of any columns that refers to
a JDBI::Collection, because there's no trivial way to do so. 

However, if the column comes with a "render_as", we can assume that
the app developer know what he/she is doing.  So we just render it
as whatever specified.

One scenario is that a collection of tags is rendered as a normal
text input field, and develoeprs create tags records in their Tag
model in before_create() method. With ajax canonicalize_tags this
could be a simple and smart interface, and not difficult to implement
at all.

I'm sure that it'll open the chance to let developers write their
own collection rendering modules like I did before. If we keep
being ignoring, this won't even happend.


Modified: jifty/trunk/lib/Jifty/Action/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record.pm	(original)
+++ jifty/trunk/lib/Jifty/Action/Record.pm	Sun May 27 07:33:49 2007
@@ -217,7 +217,13 @@
                     # No need to generate arguments for
                     # JDBI::Collections, as we can't do anything
                     # useful with them yet, anyways.
-                    next;
+
+                    # However, if the column comes with a
+                    # "render_as", we can assume that the app
+                    # developer know what he/she is doing.
+                    # So we just render it as whatever specified.
+
+                    next unless $render_as;
                 }
             }
 


More information about the Jifty-commit mailing list