diff --git a/app/models/journal.rb b/app/models/journal.rb index 0b807fb2..c7818d76 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -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)