1
我使用Hypertable數據庫與HyperRecord的前端。我修復了一些錯誤。但是現在遷移困住了我。當我做移植它顯示錯誤:Hypertable遷移導致導軌問題2.3.8
rake aborted!
undefined method `select_rows' for #<ActiveRecord::ConnectionAdapters::HypertableAdapter:0xb6f791c4>
.rvm/gems/[email protected]/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/database_statements.rb:27:in `select_values'
當我看着軌道上的代碼或ruby actice_record。表明。
# 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/[email protected]/gems/activerecord-2.3.8/lib/active_record/migration.rb:421:in `get_all_versions'
是否有任何人有一個想法,這是怎麼回事呢?
此修復程序可以完美遷移起來,活動記錄模式。只有剩下的東西是遷移回滾。 –