Sha256: 0691257a5ef3976116d229ebfa725e31df1a4ef4d3424adb9f78d7b362b246eb
Contents?: true
Size: 779 Bytes
Versions: 8
Compression:
Stored size: 779 Bytes
Contents
module AlgoliaSearch module Utilities class << self def get_model_classes Rails.application.eager_load! if Rails.application # Ensure all models are loaded (not necessary in production when cache_classes is true). AlgoliaSearch.instance_variable_get :@included_in end def clear_all_indexes get_model_classes.each do |klass| klass.clear_index! end end def reindex_all_models klasses = get_model_classes puts '' puts "Reindexing #{klasses.count} models: #{klasses.to_sentence}." puts '' klasses.each do |klass| puts klass puts "Reindexing #{klass.count} records..." klass.algolia_reindex end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems