In your engine's application controllers, inherit from parent application controller:
module EngineA
class ApplicationController < ::ApplicationController
..
سؤال
Rails 3.2 engine A
is a logger engine and there is a logger
method (create an entry in log table) defined in its application controller
. Engine B
mounts engine A
and engine B's
model
or controller
will call logger method in engine A for logging. Is there a way logger
method in engine A
could be called by engine B
without using include
or require
? Basically we want logger
method in engine A
to be automatically available for any other engines which mount it.
المحلول
In your engine's application controllers, inherit from parent application controller:
module EngineA
class ApplicationController < ::ApplicationController
..