do not create a journal when attributes change from

blank to blank (eg. nil -> "")

we first came in contact with the problem when
issue journals were created stating "description deleted"
although there has never been any description on that object
pull/41/head
Romano Licker 12 years ago
parent 90348d5d81
commit 35c84fcd68
  1. 6
      vendor/plugins/acts_as_journalized/lib/redmine/acts/journalized/changes.rb

@ -89,7 +89,11 @@ module Redmine::Acts::Journalized
# creation. Incremental changes are reset when the record is saved because they represent
# a subset of the dirty attribute changes, which are reset upon save.
def incremental_journal_changes
changed.inject({}) { |h, attr| h[attr] = attribute_change(attr); h }.slice(*journaled_columns)
changed.inject({}) do |h, attr|
h[attr] = attribute_change(attr) unless !attribute_change(attr).nil? &&
attribute_change(attr)[0].blank? && attribute_change(attr)[1].blank?
h
end.slice(*journaled_columns)
end
# Simply resets the cumulative changes after journal creation.

Loading…
Cancel
Save