Call page.versions once.

This commit is contained in:
bootstraponline
2012-05-24 18:32:45 -06:00
parent 5173c258b7
commit 22c0206451
+4 -2
View File
@@ -14,13 +14,15 @@ module Precious
end end
def author def author
first = @page.versions ? @page.versions.first : false page_versions = @page.versions
first = page_versions ? page_versions.first : false
return DEFAULT_AUTHOR unless first return DEFAULT_AUTHOR unless first
first.author.name first.author.name
end end
def date def date
first = @page.versions ? @page.versions.first : false page_versions = @page.versions
first = page_versions ? page_versions.first : false
return Time.now.strftime(DATE_FORMAT) unless first return Time.now.strftime(DATE_FORMAT) unless first
first.authored_date.strftime(DATE_FORMAT) first.authored_date.strftime(DATE_FORMAT)
end end