summaryrefslogtreecommitdiffstats
path: root/app/models/wiki_page.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-04-05 14:45:44 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-04-05 14:45:44 +0000
commitf3a1b4e38c25fd34ef19d9b04567d327c34f6713 (patch)
tree32509daacaca872a21ccbbc806caee2fb2cde6f3 /app/models/wiki_page.rb
parent7eb4abae80d7bd0b3b95c67b09f7b58b0b3ed031 (diff)
downloadredmine-f3a1b4e38c25fd34ef19d9b04567d327c34f6713.tar.gz
redmine-f3a1b4e38c25fd34ef19d9b04567d327c34f6713.zip
Added the ability to easily rollback to a previous version of a wiki page.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@424 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/wiki_page.rb')
-rw-r--r--app/models/wiki_page.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb
index 19961cb0b..f2ea8fd59 100644
--- a/app/models/wiki_page.rb
+++ b/app/models/wiki_page.rb
@@ -32,6 +32,12 @@ class WikiPage < ActiveRecord::Base
WikiPage.pretty_title(title)
end
+ def content_for_version(version=nil)
+ result = content.versions.find_by_version(version.to_i) if version
+ result ||= content
+ result
+ end
+
def self.pretty_title(str)
(str && str.is_a?(String)) ? str.tr('_', ' ') : str
end