Avoid nil.

This commit is contained in:
bootstraponline
2012-05-23 00:04:57 -06:00
parent e160822b0f
commit f765137f3f
+2 -2
View File
@@ -14,13 +14,13 @@ module Precious
end end
def author def author
first = @page.versions.first 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.first 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