[Bps-public-commit] jifty-plugin-recordhistory branch, master, updated. 539dd9acc5c80aada6786fa6c62a616d0427102c

Shawn Moore sartak at bestpractical.com
Wed Feb 9 17:12:44 EST 2011


The branch, master has been updated
       via  539dd9acc5c80aada6786fa6c62a616d0427102c (commit)
      from  53f9f22f309d8e75d5547d3941e4a853a8079491 (commit)

Summary of changes:
 .../RecordHistory/Mixin/Model/RecordHistory.pm     |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 539dd9acc5c80aada6786fa6c62a616d0427102c
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Feb 9 17:12:31 2011 -0500

    Create a Change when we create a record

diff --git a/lib/Jifty/Plugin/RecordHistory/Mixin/Model/RecordHistory.pm b/lib/Jifty/Plugin/RecordHistory/Mixin/Model/RecordHistory.pm
index c77a877..714db47 100644
--- a/lib/Jifty/Plugin/RecordHistory/Mixin/Model/RecordHistory.pm
+++ b/lib/Jifty/Plugin/RecordHistory/Mixin/Model/RecordHistory.pm
@@ -11,6 +11,18 @@ sub import {
 
     $class->export_to_level(1, @_);
 
+    $caller->add_trigger(after_create => sub {
+        my $class = shift;
+        my $id = ${ shift @_ };
+
+        my $change = Jifty::Plugin::RecordHistory::Model::Change->new;
+        $change->create(
+            record_class => $class,
+            record_id    => $id,
+            type         => 'create',
+        );
+    });
+
     $caller->add_trigger(after_set => sub {
         my $record = shift;
         my %args   = (

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



More information about the Bps-public-commit mailing list