mirror of
https://0xacab.org/sutty/sutty
synced 2025-02-23 10:41:49 +00:00
feat: url absoluta del post
This commit is contained in:
parent
b32c67f168
commit
2048cb8e03
1 changed files with 13 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue