[Radiant] extending admin_ui ?

Stephane B. stephane.busso at gmail.com
Sun May 27 16:48:59 CDT 2007


Sean Cribbs wrote:
> It is a pretty standard Ruby practice to re-open the class, but
> sometimes I find this doesn't work as expected. Instead, you can try
> doing a class_eval or module_eval on the intended class, which will
> make sure it's auto-loaded before you try to override or extend it.
> Example:
> 
> Radiant::AdminUI::Tab.class_eval {
> # your code here
> }
> 
> Cheers,
> 
> Sean

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 ?

I will try to improve my code and all suggestions are welcome :)

-- 
Posted via http://www.ruby-forum.com/.



More information about the Radiant mailing list