[Jifty-commit] r681 - Jifty-DBI/trunk/lib/Jifty/DBI

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Mar 8 14:47:44 EST 2006

Author: autrijus
Date: Wed Mar  8 14:47:44 2006
New Revision: 681


* Jifty::DBI::Record - add the API "collection_class" 
  analogous to the "record_class" offered by ::Collection.

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
--- Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm	Wed Mar  8 14:47:44 2006
@@ -968,6 +968,25 @@
     return $self->TABLE_NAME();
+=head2 collection_class
+Returns the collection class which this record belongs to; override this to
+subclass.  If you haven't specified a collection class, this returns a best
+guess at the name of the collection class for this collection.
+It uses a simple heuristic to determine the collection class name -- It
+appends "Collection" to its own name. If you want to name your records
+and collections differently, go right ahead, but don't say we didn't
+warn you.
+sub collection_class {
+    my $self = shift;
+    my $class = ref($self) || $self;
+    $class . 'Collection';
 =head2 _guess_table_name
 Guesses a table name based on the class's last part.

More information about the Jifty-commit mailing list