我在 HyperRecord 的前端使用 Hypertable db。我修复了一些错误。但是现在迁移让我陷入困境。当我进行迁移时,它会显示错误:
rake aborted!
undefined method `select_rows' for #<ActiveRecord::ConnectionAdapters::HypertableAdapter:0xb6f791c4>
.rvm/gems/ruby-1.8.7-p352@r2.3.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/database_statements.rb:27:in `select_values'
当我查看 rails actice_record 上的代码或 ruby 时。表明。
# Returns an array of arrays containing the field values.
# Order is the same as that returned by +columns+.
def select_rows(sql, name = nil)
end
undef_method :select_rows
我试图通过在初始化中添加修复来删除这些功能。
module ActiveRecord
module ConnectionAdapters
class HypertableAdapter
def select_rows(sql, name = nil)
end
end
end
end
然后它带有错误Nil value occurred while accepting array or hash
。为了修复它,我在修复代码中添加了新方法。
module ActiveRecord
module ConnectionAdapters
class HypertableAdapter
def select_rows(sql, name = nil)
end
def select_values(sql, name = nil)
result = select_rows(sql, name)
result.map { |v| v[0] } unless result.nil?
end
end
end
end
然后它出现了错误:
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.map
/.rvm/gems/ruby-1.8.7-p352@r2.3.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:421:in `get_all_versions'
有没有人有一个想法,这是怎么回事?