[Jifty-commit] r7003 - wifty/trunk/lib/Wifty/Model

Jifty commits jifty-commit at lists.jifty.org
Tue May 12 04:00:50 EDT 2009


Author: ruz
Date: Tue May 12 04:00:49 2009
New Revision: 7003

Modified:
   wifty/trunk/lib/Wifty/Model/Revision.pm

Log:
* use new methods in the collection class

Modified: wifty/trunk/lib/Wifty/Model/Revision.pm
==============================================================================
--- wifty/trunk/lib/Wifty/Model/Revision.pm	(original)
+++ wifty/trunk/lib/Wifty/Model/Revision.pm	Tue May 12 04:00:49 2009
@@ -33,7 +33,6 @@
 
 sub since { '0.0.5' }
 
-
 sub create {
     my $self = shift;
     my %args = (@_);
@@ -49,19 +48,8 @@
     return undef unless $self->id;
 
     my $revisions = Wifty::Model::RevisionCollection->new;
-    $revisions->limit(
-        column         => 'page',
-        value          => $self->page->id,
-        quote_value    => 0,
-        case_sensitive => 1
-    );
-    $revisions->limit(
-        column         => 'id',
-        operator       => '<',
-        value          => $self->id,
-        quote_value    => 0,
-        case_sensitive => 1
-    );
+    $revisions->limit_by_page($self);
+    $revisions->older_than($self);
     $revisions->order_by( { column => 'id', order => 'desc' } );
     $revisions->rows_per_page(1);
     return $revisions->first;
@@ -72,19 +60,8 @@
     return undef unless $self->id;
 
     my $revisions = Wifty::Model::RevisionCollection->new;
-    $revisions->limit(
-        column         => 'page',
-        value          => $self->page->id,
-        quote_value    => 0,
-        case_sensitive => 1
-    );
-    $revisions->limit(
-        column         => 'id',
-        operator       => '>',
-        value          => $self->id,
-        quote_value    => 0,
-        case_sensitive => 1
-    );
+    $revisions->limit_by_page($self);
+    $revisions->newer_than($self);
     $revisions->order_by( { column => 'id', order => 'asc' } );
     $revisions->rows_per_page(1);
     return $revisions->first;
@@ -144,6 +121,6 @@
         return 0;
     }
     $self->SUPER::current_user_can($right, @_);
-
 }
+
 1;


More information about the Jifty-commit mailing list