mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 08:46:21 +00:00
22 lines
416 B
Ruby
22 lines
416 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(&:index!)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|