From: gabriele renzi Date: 2004-10-27T20:04:02+09:00 Subject: Re: Gem update of Rails - Skipping require of dynamic string Francis Hwang ha scritto: > Unless I misunderstand autoload (I've never used it), it won't help what > I need. Basically, the Lafcadio ObjectStore uses method_missing more > than I've ever seen it used, to make the ObjectStore instance a proxy > for a bunch of different ways to query a database. The most common usage > is: > > os = ObjectStore.get_object_store > client = os.get_client( 1 ) > > Now, the ObjectStore can only load a Client if it's already loaded the > Client class. and this is where autoload would come, it loads the Client class whenever it is used for the first time. > I wanted to support a bunch of different ways of doing > this, and one of them is having a domain directory with each class > living in a file of the same name. > > /domain_classes/Client.rb > /domain_classes/Invoice.rb > /domain_classes/Project.rb > etc. > > (this is only one way to organize the domain classes in Lafcadio; these > days I find I don't use this much, myself.) > > So one of the things Lafcadio tries to do is load the class by doing a > dynamic require: > > require "domain_classes/#{ domain_class_name }" > > So you don't have to explicitly require those files yourself. ah, now I see what you mean, thanks for taking time to explain :)