don't rely on journal record id to find predecessor and use version instead

pull/1039/head
Markus Kahl 11 years ago
parent 359597c913
commit 05c003e11f
  1. 6
      app/models/journal.rb

@ -187,10 +187,10 @@ class Journal < ActiveRecord::Base
end
def predecessor
@predecessor ||= Journal.where("journable_type = ? AND journable_id = ? AND id < ?",
journable_type, journable_id, id)
@predecessor ||= Journal.where("journable_type = ? AND journable_id = ? AND version < ?",
journable_type, journable_id, version)
.order("version DESC")
.first
.limit(1).first
end
def journalized_object_type

Loading…
Cancel
Save