mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-14 23:31:41 +00:00
usar Post#new? que ya sabe cuándo el documento no existe aun
This commit is contained in:
parent
64b59bfc4d
commit
e19713f5df
2 changed files with 2 additions and 4 deletions
|
@ -8,7 +8,7 @@ class MetadataDocumentDate < MetadataTemplate
|
||||||
end
|
end
|
||||||
|
|
||||||
def value_from_document
|
def value_from_document
|
||||||
return nil unless document.path
|
return nil if post.new?
|
||||||
|
|
||||||
document.date
|
document.date
|
||||||
end
|
end
|
||||||
|
|
|
@ -49,9 +49,7 @@ class Post
|
||||||
public_send(attr)&.value = args[attr] if args.key?(attr)
|
public_send(attr)&.value = args[attr] if args.key?(attr)
|
||||||
end
|
end
|
||||||
|
|
||||||
# XXX: No usamos Post#read porque a esta altura todavía no sabemos
|
document.read! unless new?
|
||||||
# nada del Document
|
|
||||||
document.read! if File.exist? document.path
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def inspect
|
def inspect
|
||||||
|
|
Loading…
Reference in a new issue