avatar

40

skip_save changed to skip_log

by abloke, 12 Feb, 2007 11:20 AM
39 40  
8181       end
8282     
8383       module InstanceMethods
84         attr_accessor :skip_save
84         attr_accessor :skip_log
8585         
8686         private        
8787         # Creates a new record in the activity_logs table if applicable
------
101101         # the log if the time given by :delay_after_create has passed since the object was created. If
102102         # the object does not have a created_at attribute this switch will be ignored
103103         def write_activity_log(action = :update)
104           if @skip_save == true
105             @skip_save = false
106             return true
107           end
108           
109104           set_culprit
110105           set_referenced
111106           
112107           if self.respond_to?(:created_at) && Time.now > self.delay_after_create.since(self.created_at) or action == :create
113108             r = self.activity_logs.create :action => action.to_s, 
114109                                           :referenced => @referenced,
115                                           :culprit => @culprit
110                                           :culprit => @culprit if @skip_log == true
116111           end
112           @skip_log = false
117113         end
118114 
119115         # If the userstamp option is given, call User.current_user(supplied by the userstamp plugin)