5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 15:16:21 +00:00

Merge branch 'indexed-posts' into panel.sutty.nl

This commit is contained in:
f 2022-08-03 13:11:29 -03:00
commit d01a2de2dd
2 changed files with 4 additions and 6 deletions

View file

@ -14,7 +14,7 @@ class Post
#
# @return [IndexedPost]
def to_index
IndexedPost.find_or_create_by(post_id: uuid.value, site_id: site.id).tap do |indexed_post|
IndexedPost.find_or_initialize_by(post_id: uuid.value, site_id: site.id).tap do |indexed_post|
indexed_post.layout = layout.name
indexed_post.path = path.basename
indexed_post.locale = locale.value
@ -27,8 +27,6 @@ class Post
end
end
private
# Indexa o reindexa el Post
#
# @return [Boolean]
@ -40,6 +38,8 @@ class Post
to_index.destroy.destroyed?
end
private
# Los metadatos que se almacenan como objetos JSON. Empezamos con
# las categorías porque se usan para filtrar en el listado de
# artículos.

View file

@ -14,9 +14,7 @@ class Site
def index_posts!
Site.transaction do
docs.each do |post|
post.to_index.save
end
docs.each(&:index!)
end
end
end