lib/searchkick/tasks.rb in searchkick-0.8.7 vs lib/searchkick/tasks.rb in searchkick-0.9.0
- old
+ new
@@ -1,27 +1,27 @@
require "rake"
namespace :searchkick do
desc "reindex model"
- task :reindex => :environment do
+ task reindex: :environment do
if ENV["CLASS"]
klass = ENV["CLASS"].constantize rescue nil
if klass
klass.reindex
else
- abort "Could not find class: #{ENV["CLASS"]}"
+ abort "Could not find class: #{ENV['CLASS']}"
end
else
abort "USAGE: rake searchkick:reindex CLASS=Product"
end
end
if defined?(Rails)
namespace :reindex do
desc "reindex all models"
- task :all => :environment do
+ task all: :environment do
Rails.application.eager_load!
Searchkick.models.each do |model|
puts "Reindexing #{model.name}..."
model.reindex
end