Rails 3 - Require - Path Not Found
I have:
Windows XP Professional SP3
Ruby 1.8.7 Rails 3.0.10 Bundler 1.0.15 ImageMagick 6.5.6 Q8 Rmagick 2.12.9My gemfile:
gem 'rmagick-2.12.0-x86-mswin32', '2.12.0', :path => 'c:/sites/uplodify/vendor'
My controller:
require 'RMagick'
Here I have installed my rmagick gem:
c:/ruby/ruby187/lib/ruby/gems/1.8/gems/rmagick-2.12.0-x86-mswin32/
But when I launch the controller, there is a message:
no such file to load -- RMagick
Then, I change require 'RMagick'
to require 'c:/ruby/ruby187/lib/ruby/gems/1.8/gems/rmagick-2.12.0-x86-mswin32/lib/RMagick.rb'
, and it's work开发者_开发百科ing!!!
Question:
why require 'RMagick'
is not working, but require 'c:/ruby/ruby187/lib/ruby/gems/1.8/gems/rmagick-2.12.0-x86-mswin32/lib/RMagick.rb'
is working????
Thanks a lot!
ADDED: Hi, people. I glad to say how I solved the problem. My way was following recomendations on http://www.waydotnet.com/blog/2010/02/rmagick-on-ruby-1-9-1-i386-mingw32-work-d/....step by step...
In your Gemfile
:
gem 'rmagick', '2.12.0', :require => 'RMagick'
and remove the require
in your controller.
You're not really supposed to require
your dependencies in your rails app, bundler should do it automatically. The :require
option tells bundler that it should do a require 'RMagick'
so you don't have to do it manually.
精彩评论