lib/searchkick/tasks.rb in searchkick-2.5.0 vs lib/searchkick/tasks.rb in searchkick-3.0.0
- old
+ new
@@ -1,7 +1,5 @@
-require "rake"
-
namespace :searchkick do
desc "reindex model"
task reindex: :environment do
if ENV["CLASS"]
klass = ENV["CLASS"].constantize rescue nil
@@ -14,11 +12,10 @@
abort "USAGE: rake searchkick:reindex CLASS=Product"
end
end
if defined?(Rails)
-
namespace :reindex do
desc "reindex all models"
task all: :environment do
Rails.application.eager_load!
Searchkick.models.each do |model|
@@ -26,8 +23,7 @@
model.reindex
end
puts "Reindex complete"
end
end
-
end
end