add diff link on wiki page versions (#1622)

This commit is contained in:
Albert Yi
2018-09-17 17:36:46 -07:00
parent 79f53c25ea
commit 1a1d74d1ca
3 changed files with 23 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ class WikiPageVersion < ApplicationRecord
belongs_to :artist, optional: true
delegate :visible?, :to => :wiki_page
extend Memoist
module SearchMethods
def for_user(user_id)
where("updater_id = ?", user_id)
@@ -35,6 +37,11 @@ class WikiPageVersion < ApplicationRecord
title.tr("_", " ")
end
def previous
WikiPageVersion.where("wiki_page_id = ? and id < ?", wiki_page_id, id).order("id desc").first
end
memoize :previous
def category_name
Tag.category_for(title)
end