skip_save changed to skip_log
| 39 | 40 | |
|---|---|---|
| 81 | 81 | end |
| 82 | 82 | |
| 83 | 83 | module InstanceMethods |
| 84 | attr_accessor :skip_save | |
| 84 | attr_accessor :skip_log | |
| 85 | 85 | |
| 86 | 86 | private |
| 87 | 87 | # Creates a new record in the activity_logs table if applicable |
| --- | --- | |
| 101 | 101 | # the log if the time given by :delay_after_create has passed since the object was created. If |
| 102 | 102 | # the object does not have a created_at attribute this switch will be ignored |
| 103 | 103 | def write_activity_log(action = :update) |
| 104 | if @skip_save == true | |
| 105 | @skip_save = false | |
| 106 | return true | |
| 107 | end | |
| 108 | ||
| 109 | 104 | set_culprit |
| 110 | 105 | set_referenced |
| 111 | 106 | |
| 112 | 107 | if self.respond_to?(:created_at) && Time.now > self.delay_after_create.since(self.created_at) or action == :create |
| 113 | 108 | r = self.activity_logs.create :action => action.to_s, |
| 114 | 109 | :referenced => @referenced, |
| 115 | :culprit => @culprit | |
| 110 | :culprit => @culprit if @skip_log == true | |
| 116 | 111 | end |
| 112 | @skip_log = false | |
| 117 | 113 | end |
| 118 | 114 | |
| 119 | 115 | # If the userstamp option is given, call User.current_user(supplied by the userstamp plugin) |
