module Searchable::Dependents::User extend ActiveSupport::Concern included do after_update_commit :check_searchable_dependents end private def check_searchable_dependents if firstname_previously_changed? || lastname_previously_changed? || user_extension.school_id_previously_changed? # reindex shixun created_shixuns.each{ |shixun| shixun.reindex(:searchable_user_data) } # reindex course manage_courses.each(&:reindex) # reindex subject created_subjects.each { |subject| subject.reindex(:searchable_user_data) } end end end