[Rt-commit] rt branch, 4.2/record-and-collection-class-methods, created. rt-4.1.6-140-gf4fe36f

Thomas Sibley trs at bestpractical.com
Fri Feb 1 14:05:50 EST 2013


The branch, 4.2/record-and-collection-class-methods has been created
        at  f4fe36fcb3e9e7853fca2f812ba1ea1354ffc95d (commit)

- Log -----------------------------------------------------------------
commit 5671e604b246f60b80decffdce61969ab204c8be
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jan 31 18:36:51 2013 -0800

    Support using ->_Accessible as a class method too
    
    The ->_ClassAccessible method already does this, a few lines above, but
    is raw access to the hashref instead of attribute checking.

diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 9338a2a..c9bbb94 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -731,8 +731,8 @@ sub _Accessible  {
   my $self = shift;
   my $column = shift;
   my $attribute = lc(shift);
-  return 0 unless defined ($_TABLE_ATTR->{ref($self)}->{$column});
-  return $_TABLE_ATTR->{ref($self)}->{$column}->{$attribute} || 0;
+  return 0 unless defined ($_TABLE_ATTR->{ref($self) || $self}->{$column});
+  return $_TABLE_ATTR->{ref($self) || $self}->{$column}->{$attribute} || 0;
 
 }
 

commit f4fe36fcb3e9e7853fca2f812ba1ea1354ffc95d
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jan 31 18:37:55 2013 -0800

    Support calling RT::SearchBuilder->_SingularClass as a class method

diff --git a/lib/RT/SearchBuilder.pm b/lib/RT/SearchBuilder.pm
index c0aa94c..4bb4177 100644
--- a/lib/RT/SearchBuilder.pm
+++ b/lib/RT/SearchBuilder.pm
@@ -197,7 +197,7 @@ Takes a paramhash of key/value pairs with the following keys:
 
 sub _SingularClass {
     my $self = shift;
-    my $class = ref($self);
+    my $class = ref($self) || $self;
     $class =~ s/s$// or die "Cannot deduce SingularClass for $class";
     return $class;
 }

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


More information about the Rt-commit mailing list