Hi,
Firstly, to get an array of all the running engines, you can use
simply Engines.active - that part is easy. Read the Engines RDoc for
more details.
You should define your getMenu() method as part of some module, and
use a consistent convention for the naming of those modules. For
instance, if you have three engines ('alpha_engine', 'beta_engine',
'gamma_engine'), then you will probably be defining modules for each
of those engines, so you could have:
/vendor/plugins/alpha_engine/lib/alpha_engine.rb:
module AlphaEngine
def AlphaEngine.getMenu()
#...
end
end
... and so on for BetaEngine and GammaEngine.
That said, where you place the method really depends what your getMenu
method does. You might instead want to put it in an appropriately
named module within the app/helpers directory of each engine. The key
to detecting the availablity of this method is going to be following a
well-defined convention for it's placement.
- james
On 3/22/06, Christophe Christophe <[EMAIL PROTECTED]> wrote:
> I've successfully setup a publication engine (Publish) which I use to
> learn ROR but there is something I can't find a solution for : the main
> application (the one which make uses of this engine) has a "admin"
> layout which need to get a menu for EVERY engine installed... Let's call
> it getMenu()
>
> 1) I don't know where to define getMenu() - I've tried in several places
> - init_engine.rb included but got several error messages (ranging from
> "method not found" to "trying to access private method")
> 2) How can I iterate throught all the engines installed and check if the
> getMenu method exists ?
>
> Point 1 is the most important for me as I don't understand how I can
> make methods and attributes accessible to the outside world. For now,
> every piece of code executed by my engine is the result of a
> controller/action sequence.
>
> Same goes for engine to engine calls... How can I do ?
>
> Thanks
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> engine-users mailing list
> [email protected]
> http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org
>
--
* J *
~
_______________________________________________
engine-users mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org