diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2746ab10..218e1e55 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -96,7 +96,9 @@ class ApplicationController < ActionController::Base end def site - @site ||= find_site + @site ||= find_site.tap do |s| + s.reindex_changes! + end end protected diff --git a/app/models/post/indexable.rb b/app/models/post/indexable.rb index 40be9b1c..38a98c2b 100644 --- a/app/models/post/indexable.rb +++ b/app/models/post/indexable.rb @@ -6,9 +6,6 @@ class Post extend ActiveSupport::Concern included do - # Indexa o reindexa el Post - after_save :index! - after_destroy :remove_from_index! # @return [IndexedPost,nil] def indexed_post diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 010558d6..9301e3da 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -76,16 +76,11 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do commit_config(action: :tor) end - # Trae cambios desde la rama remota y reindexa los artículos. + # Trae cambios desde la rama remota # # @return [Boolean] def merge - result = site.repository.merge(usuarie) - - # TODO: Implementar callbacks - site.try(:index_posts!) if result - - result.present? + site.repository.merge(usuarie).present? end private