diff --git a/app/models/changeset.rb b/app/models/changeset.rb index dbab9feac..6532ade6d 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -176,18 +176,12 @@ class Changeset < ActiveRecord::Base # Returns the previous changeset def previous - @previous ||= Changeset.find(:first, - :conditions => ['id < ? AND repository_id = ?', - self.id, self.repository_id], - :order => 'id DESC') + @previous ||= Changeset.where(["id < ? AND repository_id = ?", id, repository_id]).order('id DESC').first end # Returns the next changeset def next - @next ||= Changeset.find(:first, - :conditions => ['id > ? AND repository_id = ?', - self.id, self.repository_id], - :order => 'id ASC') + @next ||= Changeset.where(["id > ? AND repository_id = ?", id, repository_id]).order('id ASC').first end # Creates a new Change from it's common parameters