sutty/app/models/site/index.rb
f df425bab5a poder indexar los sitios!
me había olvidado de este archivo
2021-05-17 15:33:46 -03:00

25 lines
461 B
Ruby

# frozen_string_literal: true
# Indexa todos los artículos de un sitio
#
# TODO: Hacer opcional
class Site
module Index
extend ActiveSupport::Concern
included do
# TODO: Debería ser un Job?
after_create :index_posts!
has_many :indexed_posts, dependent: :destroy
def index_posts!
Site.transaction do
docs.each do |post|
post.to_index.save
end
end
end
end
end
end