From: Ash Berlin Date: Mon, 14 Aug 2006 17:20:50 +0000 (+0000) Subject: Changed the docs for relationship attributes, and added rel order_by example X-Git-Tag: v0.07002~38 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f8bad7690ec8115ba42c6fe55a5ddb3a0ad2b8dd;p=dbsrgits%2FDBIx-Class.git Changed the docs for relationship attributes, and added rel order_by example to cookbook. --- diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index 689a9fe..a0bce5e 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -419,6 +419,17 @@ Deletes only the book named Titanic by the author in $author. my $author->delete_related('books', { name => 'Titanic' }); +=head3 Ordering a relationship result set + +If you always want a relation to be ordered, you can specify this when you +create the relationship. + +To order C<< $book->pages >> by descending page_number. + + Book->has_many('pages' => 'Page', 'book', { order_by => \'page_number DESC'} ); + + + =head2 Transactions As of version 0.04001, there is improved transaction support in diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index 6b8a7a9..9797b7c 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -67,7 +67,7 @@ Each key-value pair provided in a hashref will be used as Ced conditions. To add an Ced condition, use an arrayref of hashrefs. See the L documentation for more details. -Valid attributes are as follows: +In addition to standard result set attributes, the following attributes are also valid: =over 4