From: Emmanuel Oga Date: 2007-11-05T12:19:57+09:00 Subject: Re: Reading a class-file and calling it at runtime. I'm not sure what you are trying to acomplish... but here is a trick i use when rails mess with my requires. def require_relative *args path= File.dirname(args.shift) args.each { |arg| path= File.join(path, arg) } require path end This will require the file with full file name. Now you can do Dir[File.join(File.dirname(__FILE__), '/plugins/*.rb')].each do |file| require_relative __FILE__, file end That loads every file of directory plugins. Now, if you named the files according to rails convetions, ie: my_class_name.rb for MyClassName class, you can do something like: plugin_classes= [] Dir[File.join(File.dirname(__FILE__), '/plugins/*.rb')].each do |file| require_relative __FILE__, file name= File.basename(file) plugin_classes << $1.camelize.constantize if name =~ /(.*)\.rb$/i end There... it sounds easy, no? :) -- Posted via http://www.ruby-forum.com/.