Avoid nil.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user