added related tag query model, fixes to related tag calculator
This commit is contained in:
@@ -88,4 +88,14 @@ class WikiPage < ActiveRecord::Base
|
||||
def presenter
|
||||
@presenter ||= WikiPagePresenter.new(self)
|
||||
end
|
||||
|
||||
def tags
|
||||
body.scan(/\[\[(.+?)\]\]/).flatten.map do |match|
|
||||
if match =~ /^(.+?)\|(.+)/
|
||||
$1
|
||||
else
|
||||
match
|
||||
end
|
||||
end.map {|x| x.downcase.tr(" ", "_")}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user