Refactor Web#authors and document it using Yard-style markup

This commit is contained in:
James Herdman 2009-08-29 14:52:06 -04:00
parent c0cab0d0b7
commit b96810fd2e

View file

@ -23,14 +23,13 @@ class Web < ActiveRecord::Base
page.revise(content, name, time, author, renderer) page.revise(content, name, time, author, renderer)
end end
# @return [Array<String>] a collection of all the names of the authors that
# have ever contributed to the pages for this Web
def authors def authors
connection.select_all( revisions.all(
'SELECT DISTINCT r.author AS author ' + :select => "DISTINCT revisions.author",
'FROM revisions r ' + :order => "1"
'JOIN pages p ON p.id = r.page_id ' + ).collect(&:author)
'WHERE p.web_id = ' + self.id.to_s +
' ORDER by 1 '
).collect { |row| row['author'] }
end end
def categories def categories