I am writing a Rails plugin (let's call it Foo). I want it to provide a "bar" class function in controllers so that I can:
class ApplicationController
bar ...
end
barIt is determined from a call to the plugin loader file / plugins / foo / init.rb. Sort of
class ActionController::Base
def self.bar
...
end
end
The problem is that some other plugins (in my case the ResourceController) can load before foo and access the ApplicationController.
So what happens is that the ApplicationController is loaded before the "foo" plugin and does not work, since there is no "bar" defined by YET .
So ... how do I get it to work correctly ?
, , ActionController (, inherited_resources, resource_controller), , , , , , .
, ApplicationController 'foo'. , "foo".
"require". :)