Commit 53165359 authored by Felix Schäfer's avatar Felix Schäfer

Touch journaled objects on journal creation only. #543

parent 55f9ecbe
......@@ -28,9 +28,12 @@ class Journal < ActiveRecord::Base
# subclasses will be given an actual class name when they are created by aaj
#
# e.g. IssueJournal will get :class_name => 'Issue'
belongs_to :journaled, :touch => true, :class_name => 'Journal'
belongs_to :journaled, :class_name => 'Journal'
belongs_to :user
# "touch" the journaled object on creation
after_create :touch_journaled_after_creation
# ActiveRecord::Base#changes is an existing method, so before serializing the +changes+ column,
# the existing +changes+ method is undefined. The overridden +changes+ method pertained to
# dirty attributes, but will not affect the partial updates functionality as that's based on
......@@ -38,6 +41,10 @@ class Journal < ActiveRecord::Base
# undef_method :changes
serialize :changes, Hash
def touch_journaled_after_creation
journaled.touch
end
# In conjunction with the included Comparable module, allows comparison of journal records
# based on their corresponding version numbers, creation timestamps and IDs.
def <=>(other)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment