[Bps-public-commit] jifty-plugin-recordhistory branch, master, updated. c5c4eb05fc26cdfeca3b04d446b8b74fef73d92f
Shawn Moore
sartak at bestpractical.com
Wed Feb 9 17:39:06 EST 2011
The branch, master has been updated
via c5c4eb05fc26cdfeca3b04d446b8b74fef73d92f (commit)
from 269197092cfdf491e3503687c9a92aecf5ffb9ba (commit)
Summary of changes:
.../RecordHistory/Mixin/Model/RecordHistory.pm | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit c5c4eb05fc26cdfeca3b04d446b8b74fef73d92f
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Wed Feb 9 17:38:32 2011 -0500
First pass at really adding record history on update
diff --git a/lib/Jifty/Plugin/RecordHistory/Mixin/Model/RecordHistory.pm b/lib/Jifty/Plugin/RecordHistory/Mixin/Model/RecordHistory.pm
index 01c0a67..201ea3f 100644
--- a/lib/Jifty/Plugin/RecordHistory/Mixin/Model/RecordHistory.pm
+++ b/lib/Jifty/Plugin/RecordHistory/Mixin/Model/RecordHistory.pm
@@ -24,14 +24,26 @@ sub import {
});
$caller->add_trigger(after_set => sub {
- my $record = shift;
+ my $self = shift;
my %args = (
column => undef,
value => undef,
@_,
);
- # add to the current change
+ # TODO: instead of always creating a change, see if there's an active one
+ my $change = Jifty::Plugin::RecordHistory::Model::Change->new;
+ $change->create(
+ record_class => ref($self),
+ record_id => $self->id,
+ type => 'update',
+ );
+
+ # TODO: capture old_value somehow
+ $change->add_change_field(
+ column => $args{column},
+ new_value => $args{value},
+ );
});
}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list