Permalink
Browse files

修改 tasks.rb, 判断是否继承自 ActiveRecord::Base, 应该用 klass < ActiveRecord::Base

  • Loading branch information...
1 parent fbfdc81 commit bdb2e2029acaa0f6d8eb8a353b537048b11d467f tumayun committed Apr 23, 2014
Showing with 6 additions and 6 deletions.
  1. +5 −5 lib/redis/search/tasks.rb
  2. +1 −1 spec/spec_helper.rb
View
@@ -11,21 +11,21 @@
puts ""
Redis::Search.indexed_models.each do |klass|
print "[#{klass.to_s}]"
- if klass.superclass.to_s == "ActiveRecord::Base"
+ if klass < ActiveRecord::Base
klass.find_in_batches(:batch_size => 1000) do |items|
items.each do |item|
item.redis_search_index_create
- item = nil
- count += 1
+ item = nil
+ count += 1
print "."
end
end
elsif klass.included_modules.collect { |m| m.to_s }.include?("Mongoid::Document")
klass.all.each_slice(1000) do |items|
items.each do |item|
item.redis_search_index_create
- item = nil
- count += 1
+ item = nil
+ count += 1
print "."
end
end
View
@@ -1,6 +1,6 @@
require 'rubygems'
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __FILE__)
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', File.dirname(__FILE__))
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

0 comments on commit bdb2e20

Please sign in to comment.