5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-06-02 13:44:15 +00:00

permitir indexar

This commit is contained in:
f 2022-08-03 13:11:06 -03:00
parent d5f6d3c61b
commit 3e442865ab
2 changed files with 4 additions and 6 deletions

View file

@ -14,7 +14,7 @@ class Post
# #
# @return [IndexedPost] # @return [IndexedPost]
def to_index 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.layout = layout.name
indexed_post.path = path.basename indexed_post.path = path.basename
indexed_post.locale = locale.value indexed_post.locale = locale.value
@ -27,8 +27,6 @@ class Post
end end
end end
private
# Indexa o reindexa el Post # Indexa o reindexa el Post
# #
# @return [Boolean] # @return [Boolean]
@ -40,6 +38,8 @@ class Post
to_index.destroy.destroyed? to_index.destroy.destroyed?
end end
private
# Los metadatos que se almacenan como objetos JSON. Empezamos con # Los metadatos que se almacenan como objetos JSON. Empezamos con
# las categorías porque se usan para filtrar en el listado de # las categorías porque se usan para filtrar en el listado de
# artículos. # artículos.

View file

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