Commit 8bfa52d5 authored by jplang's avatar jplang

Code cleanup.

git-svn-id: https://svn.redmine.org/redmine/trunk@16891 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 45552487
......@@ -89,7 +89,7 @@ class WikiContentVersion < ActiveRecord::Base
# Returns the previous version or nil
def previous
@previous ||= WikiContentVersion.
reorder('version DESC').
reorder(version: :desc).
includes(:author).
where("wiki_content_id = ? AND version < ?", wiki_content_id, version).first
end
......@@ -97,7 +97,7 @@ class WikiContentVersion < ActiveRecord::Base
# Returns the next version or nil
def next
@next ||= WikiContentVersion.
reorder('version ASC').
reorder(version: :asc).
includes(:author).
where("wiki_content_id = ? AND version > ?", wiki_content_id, version).first
end
......@@ -107,7 +107,7 @@ class WikiContentVersion < ActiveRecord::Base
# Updates page's content if the latest version is removed
# or destroys the page if it was the only version
def page_update_after_destroy
latest = page.content.versions.reorder("#{self.class.table_name}.version DESC").first
latest = page.content.versions.reorder(version: :desc).first
if latest && page.content.version != latest.version
raise ActiveRecord::Rollback unless page.content.revert_to!(latest)
elsif latest.nil?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment