[Bps-public-commit] jifty-plugin-recordhistory branch, master, updated. 43b836216ed644f2c6e47097db2c9a60d111f958

Shawn Moore sartak at bestpractical.com
Fri Feb 11 23:23:25 EST 2011


The branch, master has been updated
       via  43b836216ed644f2c6e47097db2c9a60d111f958 (commit)
      from  5e4f91d653e2e017df789585d375450b022304d6 (commit)

Summary of changes:
 lib/Jifty/Plugin/RecordHistory/Model/Change.pm |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 43b836216ed644f2c6e47097db2c9a60d111f958
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Feb 11 23:22:24 2011 -0500

    Handle create in delegate_current_user_can

diff --git a/lib/Jifty/Plugin/RecordHistory/Model/Change.pm b/lib/Jifty/Plugin/RecordHistory/Model/Change.pm
index 01b026b..9d4647e 100644
--- a/lib/Jifty/Plugin/RecordHistory/Model/Change.pm
+++ b/lib/Jifty/Plugin/RecordHistory/Model/Change.pm
@@ -53,8 +53,14 @@ sub deferred_create {
 # a "record" method that walks around ACLs
 sub __record {
     my $self = shift;
-    my $record = $self->__value('record_class')->new;
-    $record->load($self->__value('record_id'));
+    my %args = @_;
+
+    my $class = $args{record_class} || $self->__value('record_class');
+    my $id    = $args{record_id}    || $self->__value('record_id');
+
+    my $record = $class->new;
+    $record->load($id);
+
     return $record;
 }
 
@@ -72,7 +78,7 @@ sub delegate_current_user_can {
 
     $right = 'update' if $right ne 'read';
 
-    return $self->__record->current_user_can($right);
+    return $self->__record(%args)->current_user_can($right);
 }
 
 sub add_change_field {

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



More information about the Bps-public-commit mailing list