On May 27, 2007, at 5:48 PM, Stephane B. wrote:

> Thanks for your help. Finally I put my extended code in the definition
> of the extension. It looks to work fine... but not really clean. It
> seems that only my folder lib/radiant can't be loaded :(, is there any
> way to force to load this folder ?
>
> I saw when creating a new class, it will load it only if I call an
> instance of it; only at this stage radiant/rails will look in the lib
> folder. Then in the case of Radiant::AdminUI I guess it will not  
> look in
> lib as the class already exist.
>
> Is it a matter of Radiant extension mechanism ?

As you suspect, Radiant::AdminUI is discovered before your extension  
is loaded. Your file will not be discovered; the dependencies  
mechanism which provides for the discovery of missing constants will  
not be triggered - Radiant::AdminUI is not missing, though if it  
were, it would find it in your <ext>/lib.

If you do not care for the solution you have in place, you could  
place your code in a file like <ext>/lib/radiant/admin_ui_ext.rb,  
then in your extension loader, 'require "radiant/admin_ui_ext"'. Now  
the ugly is in the fact that you have a file named slightly  
differently than the class it contains, and reloading will not work,  
as far as I understand dependencies.rb (a Rails thing).

So, I guess you may have to leave it the way it is.

   adam williams

_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to