Last active
December 15, 2015 10:19
-
-
Save spk/5245216 to your computer and use it in GitHub Desktop.
Regenerate all ES indexes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
namespace :indexes do | |
desc "Regenerate all ES indexes" | |
task :regenerate => [:environment] do | |
Rails.application.eager_load! | |
ActiveRecord::Base.descendants.each do |model| | |
if model.respond_to?(:tire) | |
puts "* (Re)generating indexes for model #{model.name}" | |
sh "bundle exec rake environment tire:import CLASS='#{model.name}'" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment