[email protected] wrote: > AS includes only files which extend rails (lib/extensions), but it doesn't > include own classes. When an ActiveScaffold class is used, if it isn't > loaded, rails load it automatically. But when a plugin define an > ActiveScaffold class in initialization, it breaks autoloading. So you must > use ActiveScaffold::Config::Core.class_eval,
Thanks for confirming this. When did this behaviour change though? Clearly it worked in the past because every other AS plugin is written like this? Aha, re-reading your comment - you say AS only includes these files, so presumably there was a change in the past to avoid autoloading everything and leave it to the interpreter to load only what is needed? > or define methods in other > module and use ActiveScaffold::Config::Core.send :include, PluginModule. I > use this methods when I build ActiveScaffold plugins. > Hmm, this could be neater Have you got an example of how you do it? It might be interesting to align the naming so that the autoloading works on plugin classes also. It would perhaps make sense to make a module with the same name as the class in an appropriately named file and tuck in a .send at the end of the file? I'm now stuck on how to inject view paths from a plugin into the main AS search path. It means somehow affecting either @active_scaffold_paths or @active_scaffold_frontends. Would you be averse to adding some setter methods here to allow it to be mangled? I think just an "active_scaffold_paths=" would be enough (assuming plugin loading order is after AS), but alternatively we could introduce a pre_ and post_ set of paths which are prepended and postpended to the AS frontend paths? Ed W --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
