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 end
def predecessor def predecessor
@predecessor ||= Journal.where("journaled_type = ? AND journaled_id = ? AND created_at <= ? AND id < ?", @predecessor ||= Journal.where("journaled_type = ? AND journaled_id = ? AND id < ?",
journaled_type, journaled_id, created_at, id) journaled_type, journaled_id, id)
.order("created_at DESC") .order("version DESC")
.first .first
end end

Loading…
Cancel
Save