diff options
Diffstat (limited to 'app/models/wiki_content.rb')
-rw-r--r-- | app/models/wiki_content.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb index d0a48467b..c307beb1d 100644 --- a/app/models/wiki_content.rb +++ b/app/models/wiki_content.rb @@ -60,6 +60,14 @@ class WikiContent < ActiveRecord::Base data end end + + # Returns the previous version or nil + def previous + @previous ||= WikiContent::Version.find(:first, + :order => 'version DESC', + :include => :author, + :conditions => ["wiki_content_id = ? AND version < ?", wiki_content_id, version]) + end end end |