在heroku Cedar上的CSV

den*_*min 5 ruby csv ruby-on-rails

我想在heroku雪松上使用带有rails 3.2.1的CSV模块,但是

require 'CSV'
Run Code Online (Sandbox Code Playgroud)

不起作用

这是使用控制台测试时的错误:

Loading production environment (Rails 3.2.1)
irb(main):001:0> require 'CSV'
LoadError: no such file to load -- CSV
    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require'
    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
    from (irb):1
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/commands/console.rb:47:in `start'
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/commands/console.rb:8:in `start'
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
Run Code Online (Sandbox Code Playgroud)

Joh*_*non 13

尝试

require 'csv'
Run Code Online (Sandbox Code Playgroud)

这是区分大小写的.

更新:这不是一个Heroku问题提醒你 - 如果你在本地做同样的事情,你会得到同样的恐怖.CSV位于Ruby 1.9的标准库中.

  • 不区分大小写的文件系统,例如Windows和OSX中常用的文件系统(尽管HFS +可以配置为区分大小写),可以让您在区分大小写的环境中做一些事情.您的生产系统很可能是linux. (5认同)