【问题标题】:CSV on heroku CedarHeroku Cedar 上的 CSV
【发布时间】:2012-02-20 20:06:42
【问题描述】:

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

require 'CSV'

没有用

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

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>'

【问题讨论】:

  • 您是否将其添加到您的捆绑包并运行捆绑安装?

标签: ruby-on-rails ruby csv


【解决方案1】:

试试

require 'csv'

区分大小写。

更新:请注意,这不是 Heroku 问题 - 如果您在本地执行相同操作,您将得到相同的错误。 CSV 在 Ruby 1.9 的标准库中。

【讨论】:

  • 很简单,谢谢,它在我的本地机器上可以大写和小写,知道为什么吗?
  • 在本地我使用 ruby​​ 1.9.2p180(2011-02-18 修订版 30909)[x86_64-darwin10.7.0]
  • 确实如此,与 ruby​​ 1.9.2p290(也在 OSX 上)相同 - 我的错。
  • 不区分大小写的文件系统,例如 Windows 和 OSX 中常用的文件系统(虽然 HFS+ 可以配置为区分大小写),让您可以在区分大小写的环境中执行一些操作。您的生产系统很可能是 linux。
猜你喜欢
  • 2013-05-29
  • 2012-07-11
  • 1970-01-01
  • 2012-06-13
  • 2012-07-10
  • 2011-10-20
  • 2015-09-11
  • 2011-12-26
  • 1970-01-01
相关资源
最近更新 更多