$ sudo gem install aws-s3
$ irb -rubygems
$ require 'aws/s3'
=> true
所以我有宝石一切正常..但现在我安装到我的应用程序..
$ script/console
$ require 'aws/s3'
MissingSourceFile: no such file to load -- aws/s3
from /Library/Ruby/Gems/1.8/gems/radiant-0.9.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Library/Ruby/Gems/1.8/gems/radiant-0.9.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Library/Ruby/Gems/1.8/gems/radiant-0.9.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/radiant-0.9.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from (irb):1
那可能是什么?
答案 0 :(得分:6)
很难准确说出您的问题是什么,但根据您的导轨版本,您应该确保在Gemfile
(rails-3)或environment.rb
(导轨)中指定了宝石2)。
一旦你解决了这个问题,我建议你花点时间了解更多关于管理宝石的知识,这不是一个困难的话题,而且会带来好处。我建议调查rvm并打破使用sudo
安装宝石的习惯。
如果您使用的是Rails 2,您还应该考虑升级到rails 3或using bundler(这是一个旧的链接,但我认为说明仍然有效。)