[Bps-public-commit] App-Changeloggr branch, master, updated. 3d4fbda33fdea292633488075fddab62c737dead

sartak at bestpractical.com sartak at bestpractical.com
Fri May 22 14:48:10 EDT 2009


The branch, master has been updated
       via  3d4fbda33fdea292633488075fddab62c737dead (commit)
      from  73cbf82385c474693acc3e3960139c3cb9deabee (commit)

Summary of changes:
 lib/App/Changeloggr/Model/Tag.pm           |   24 ---------------------
 lib/App/Changeloggr/Model/TagCollection.pm |   31 ++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 24 deletions(-)
 create mode 100644 lib/App/Changeloggr/Model/TagCollection.pm

- Log -----------------------------------------------------------------
commit 3d4fbda33fdea292633488075fddab62c737dead
Author: Shawn M Moore <sartak at gmail.com>
Date:   Fri May 22 14:47:59 2009 -0400

    Whoops, limit_to_visible goes in TagCollection not Tag

diff --git a/lib/App/Changeloggr/Model/Tag.pm b/lib/App/Changeloggr/Model/Tag.pm
index 01eddc8..6c9435f 100644
--- a/lib/App/Changeloggr/Model/Tag.pm
+++ b/lib/App/Changeloggr/Model/Tag.pm
@@ -68,29 +68,5 @@ sub current_user_can {
     return $self->SUPER::current_user_can($right, @_);
 }
 
-sub limit_to_visible {
-    my $self = shift;
-
-    if ($self->_handle->isa('Jifty::DBI::Handle::SQLite')) {
-        $self->limit(
-            column   => 'text',
-            escape   => '\\',
-            operator => 'NOT LIKE',
-            value    => '\_%',
-        );
-    }
-    elsif ($self->_handle->isa('Jifty::DBI::Handle::Pg')) {
-        $self->limit(
-            column => 'text',
-            # ...
-        );
-    }
-    else {
-        Carp::confess "You must use SQLite or Postgres, or fix Tags->limit_to_visible for your RDBMS. Sorry. :(";
-    }
-
-    return $self;
-}
-
 1;
 
diff --git a/lib/App/Changeloggr/Model/TagCollection.pm b/lib/App/Changeloggr/Model/TagCollection.pm
new file mode 100644
index 0000000..0cba1e9
--- /dev/null
+++ b/lib/App/Changeloggr/Model/TagCollection.pm
@@ -0,0 +1,31 @@
+package App::Changeloggr::Model::TagCollection;
+use strict;
+use warnings;
+use base 'App::Changeloggr::Collection';
+
+sub limit_to_visible {
+    my $self = shift;
+
+    if ($self->_handle->isa('Jifty::DBI::Handle::SQLite')) {
+        $self->limit(
+            column   => 'text',
+            escape   => '\\',
+            operator => 'NOT LIKE',
+            value    => '\_%',
+        );
+    }
+    elsif ($self->_handle->isa('Jifty::DBI::Handle::Pg')) {
+        $self->limit(
+            column => 'text',
+            # ...
+        );
+    }
+    else {
+        Carp::confess "You must use SQLite or Postgres, or fix Tags->limit_to_visible for your RDBMS. Sorry. :(";
+    }
+
+    return $self;
+}
+
+1;
+

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list