The ApplicationHelper is part of your application code, not the rails
code (it is created when you generate a rails app).  I.e., it is in
app/helpers, not vendor/rails.

The plugins are loaded before your application code is loaded.

See..
http://github.com/rails/rails/blob/beb091ea18d0454379fb235308f628a3719154ea/railties/lib/initializer.rb

The workflow for initialize starts at "def process" around line 123.
Plugins are loaded at 162 and your app is loaded around 194 (but in
development mode, it's loaded as needed).

If you want to add a helper in a plugin, you can create a module,
which you can then manually include in a helper...

module ApplicationHelper
  include MyMethodsFromMyPlugin
  ...
end

Or, you can possibly define the ApplicationHelper in your plugin, and
let your application 're-open' it.

Darren


On Thu, Jun 4, 2009 at 12:17 PM, Guyren G Howe <[email protected]> wrote:
>
> I want to patch ApplicationHelper in a plugin.
>
> In my initialization, I tried
>        ApplicationHelper.module_eval
>
> and
>
>        ApplicationHelper.class_eval
>
> and
>
>        Module ApplicationHelper
>
> but none worked.
>
> Not obvious why.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to