Modified: branches/event_logging/vendor/plugins/acts_as_activity_logged/lib/acts_as_activity_logged.rb (1884 => 1885)
--- branches/event_logging/vendor/plugins/acts_as_activity_logged/lib/acts_as_activity_logged.rb 2008-10-24 10:42:22 UTC (rev 1884)
+++ branches/event_logging/vendor/plugins/acts_as_activity_logged/lib/acts_as_activity_logged.rb 2008-10-24 15:47:40 UTC (rev 1885)
@@ -130,9 +130,13 @@
# the object does not have a created_at attribute this switch will be ignored
def write_activity_log(action = ""
begin
+ # explicitly switch on timestamping for event log
+ previous_record_timestamps = ActivityLog.record_timestamps
+ ActivityLog.record_timestamps = true
+
# make sure that no logging is done within :delay_after_create time;
# if no waiting required && if the filtering not required, write the log straight away
- if (self.respond_to?(:created_at) && Time.now > self.delay_after_create.since(self.created_at)) || action == :create
+ if (self.respond_to?(:created_at) && !self.created_at.nil? && Time.now > self.delay_after_create.since(self.created_at)) || action == :create || self.created_at.nil?
write_log = (self.check_log_allowed ? self.log_allowed(action.to_s) : true)
if write_log
set_culprit
@@ -141,6 +145,8 @@
log_entry.save
end
end
+
+ ActivityLog.record_timestamps = previous_record_timestamps
rescue Exception => e
# something went wrong - exception was thrown
al = ActivityLog.new(:action ="" action.to_s, :activity_loggable => self)