5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-14 18:01:42 +00:00

usar Post#new? que ya sabe cuándo el documento no existe aun

This commit is contained in:
f 2021-05-17 12:43:23 -03:00
parent 64b59bfc4d
commit e19713f5df
2 changed files with 2 additions and 4 deletions

View file

@ -8,7 +8,7 @@ class MetadataDocumentDate < MetadataTemplate
end
def value_from_document
return nil unless document.path
return nil if post.new?
document.date
end

View file

@ -49,9 +49,7 @@ class Post
public_send(attr)&.value = args[attr] if args.key?(attr)
end
# XXX: No usamos Post#read porque a esta altura todavía no sabemos
# nada del Document
document.read! if File.exist? document.path
document.read! unless new?
end
def inspect