added related tag query model, fixes to related tag calculator

This commit is contained in:
albert
2011-09-30 16:40:24 -04:00
parent 818ffb534b
commit 3748934648
4 changed files with 135 additions and 3 deletions

View File

@@ -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