5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 01:06:22 +00:00
panel/app/models/site/index.rb

25 lines
489 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Site
# Indexa todos los artículos de un sitio
#
# TODO: Hacer opcional
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
2022-08-03 16:11:06 +00:00
docs.each(&:index!)
update(last_indexed_commit: repository.head_commit.oid)
end
end
end
end
end