Order journals by version

pull/312/head
Hagen Schink 11 years ago
parent 41f50d4e36
commit 4daa1c6e0c
  1. 6
      app/models/journal.rb

@ -131,9 +131,9 @@ class Journal < ActiveRecord::Base
end
def predecessor
@predecessor ||= Journal.where("journaled_type = ? AND journaled_id = ? AND created_at <= ? AND id < ?",
journaled_type, journaled_id, created_at, id)
.order("created_at DESC")
@predecessor ||= Journal.where("journaled_type = ? AND journaled_id = ? AND id < ?",
journaled_type, journaled_id, id)
.order("version DESC")
.first
end

Loading…
Cancel
Save