Touch journaled objects on journal creation only. #543
This commit is contained in:
parent
55f9ecbe23
commit
531653596d
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue