Stefano Crocco
2/20/2009 7:27:00 AM
Alle Friday 20 February 2009, Elias Orozco ha scritto:
> Hello guys,
>
> I need to load a path not a file. I am trying this but it is not working
>
> load RAILS_ROOT+"/public/users/#{self.login}/lib/"
>
> Can you guys help me,
>
> Thanks
What do you mean by "load a path"? A path isn't a ruby file, so you can't load
it. If you mean "load all ruby files contained in a directory", you can do
something like this:
dir = RAILS_ROOT+"/public/users/#{self.login}/lib/"
Dir.entries(d).each do |f|
load File.join(d, f) if file.match(/\.rb$/)
end
Stefano