Skip to content

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

Merged
merged 1 commit into from Apr 23, 2014

2 participants

@tumayun
tumayun commented Apr 23, 2014

修改 tasks.rb, 判断是否继承自 ActiveRecord::Base, 应该用 klass < ActiveRecord::Base
还有 ENV['BUNDLE_GEMFILE'] 指定错误

@tumayun tumayun commented on the diff Apr 23, 2014
lib/redis/search/tasks.rb
@@ -11,12 +11,12 @@
puts ""
Redis::Search.indexed_models.each do |klass|
print "[#{klass.to_s}]"
- if klass.superclass.to_s == "ActiveRecord::Base"
+ if klass < ActiveRecord::Base
@tumayun
tumayun added a note Apr 23, 2014
class Address < ActiveRecord::Base
end

class HomeAddress < Address
end

HomeAddress.superclass.to_s # "Address"
HomeAddress.superclass.to_s == 'ActiveRecord::Base' # false
HomeAddress < ActiveRecord::Base # true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@tumayun tumayun commented on the diff Apr 23, 2014
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__))
@tumayun
tumayun added a note Apr 23, 2014
File.expand_path('../Gemfile', __FILE__) # /home/tumayun/workspace/code/redis-search/spec/Gemfile
File.expand_path('../Gemfile', File.dirname(__FILE__)) # /home/tumayun/workspace/code/redis-search/Gemfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@huacnlee huacnlee merged commit f58fb3c into huacnlee:master Apr 23, 2014

1 check passed

Details continuous-integration/travis-ci The Travis CI build passed
@tumayun tumayun referenced this pull request Apr 24, 2014
Closed

不支持单表继承 #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.