From: Brian Candler Date: 2010-06-12T01:18:37+09:00 Subject: Re: require command problem Pen Ttt wrote: > i have write a class ,use command to put in the > /usr/lib/ruby/1.8/rubygems/Webmovie.rb But /usr/local/lib/1.8/rubygems is not in the load path (i.e. ruby doesn't look for files there), so ruby won't find it. $ irb --simple-prompt >> $LOAD_PATH => ["/usr/local/lib/site_ruby/1.8", "/usr/local/lib/site_ruby/1.8/x86_64-linux", "/usr/local/lib/site_ruby", "/usr/lib/ruby/vendor_ruby/1.8", "/usr/lib/ruby/vendor_ruby/1.8/x86_64-linux", "/usr/lib/ruby/vendor_ruby", "/usr/lib/ruby/1.8", "/usr/lib/ruby/1.8/x86_64-linux", "."] On your system, /usr/local/lib/site_ruby is probably the appropriate place to put ad-hoc libraries. Otherwise, your program can choose the location: $LOAD_PATH.unshift "/path/to/my/lib" rubygems itself does add things to $LOAD_PATH, but they typically are of the form /usr/lib/ruby/gems/1.8/gems/-/lib. If you want your library to go here, then package it up as a gem, and install the gem. (For Ubuntu, with rubygems installed using apt-get, it'll be /var/lib/gems/1.8/...) -- Posted via http://www.ruby-forum.com/.