5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2025-02-23 05:01:51 +00:00

feat: url absoluta del post

This commit is contained in:
f 2025-01-27 15:33:23 -03:00
parent b32c67f168
commit 2048cb8e03
No known key found for this signature in database

View file

@ -404,6 +404,19 @@ class Post
@usuaries ||= document_usuaries.empty? ? [] : Usuarie.where(id: document_usuaries).to_a
end
# Devuelve la URL absoluta
#
# @return [String, nil]
def absolute_url
return unless written?
@absolute_url ||=
URI.parse(site.url).tap do |uri|
uri.path = document.url
end.to_s
end
private
# Levanta un error si al construir el artículo no pasamos un atributo.