Skip to content
This repository has been archived by the owner on Mar 6, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #33 from tumayun/master
修改 tasks.rb, 判断是否继承自 ActiveRecord::Base, 应该用 klass < ActiveRecord::Base
  • Loading branch information
huacnlee committed Apr 23, 2014
2 parents fbfdc81 + bdb2e20 commit f58fb3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions lib/redis/search/tasks.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
@@ -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'))
Expand Down

0 comments on commit f58fb3c

Please sign in to comment.