Adds #current_version? method to wiki content.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7972 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-11-28 20:12:03 +00:00
parent 744e4357a0
commit b8a924e4e1
5 changed files with 46 additions and 5 deletions
+10
View File
@@ -45,6 +45,11 @@ class WikiContent < ActiveRecord::Base
notified.collect(&:mail)
end
# Return true if the content is the current page content
def current_version?
true
end
class Version
belongs_to :page, :class_name => '::WikiPage', :foreign_key => 'page_id'
belongs_to :author, :class_name => '::User', :foreign_key => 'author_id'
@@ -101,6 +106,11 @@ class WikiContent < ActiveRecord::Base
page.project
end
# Return true if the content is the current page content
def current_version?
page.content.version == self.version
end
# Returns the previous version or nil
def previous
@previous ||= WikiContent::Version.find(:first,