我有一个在 ruby 1.9.2 和 linux 上运行的现有 rails 应用程序,它的 rails 版本是
rails 2.3.8
它也有一个 GEMFILE,在它的 vendor/gems 目录中它有'fastercsv-1.5.4' gem
,并且在它的迁移中(在两个迁移中)它需要 gem'fastercsv'
require 'fastercsv'
但是当我这样做时
rake db:migrate
它失败了迁移声明
“请切换到 Ruby 1.9 的标准 CSV 库。它是 FasterCSV 加上对 Ruby 1.9 的 m17n 编码引擎的支持。”
我发现消息来自 gems 'faster_csv.rb' 文件。因为它有条件检查 ruby 版本
if RUBY_VERSION >= "1.9"
class FasterCSV
def self.const_missing(*_)
raise NotImplementedError, "Please switch to Ruby 1.9's standard CSV " +
"library. It's FasterCSV plus support for " +
"Ruby 1.9's m17n encoding engine."
end
def self.method_missing(*_)
const_missing
end
def method_missing(*_)
self.class.const_missing
end
end
-- and more code
有人可以告诉我如何解决这个问题。请注意,“fastercsv”尚未添加到 GEMFILE。