Extending ApplicationHelper not working with plugins


#1

Hi!

I want a plugin to supply me with additonal helpers like this:

#/vendor/plugins/test_plugin/init.rb
module ApplicationHelper
def test_helper
‘does this work?’
end
end

Contrary to my expectation, the method “test_helper” is not
available in my views…

I thought that maybe the module ApplicationHelper is namespaced
inside some other class, but I can’t find anything about that in the
source code.
ApplicationHelperI’m running Rails 0.14.3.

Thanks,
Rob


#2

Hello Francois!

Thanks for the quick answer. Your solution worked :slight_smile:

I’m gonna post this in the WIKI now, so that others will be warned

Rob


#3

Hello Robert !

2005/11/8, Robert removed_email_address@domain.invalid:

I thought that maybe the module ApplicationHelper is namespaced
inside some other class, but I can’t find anything about that in the
source code.
ApplicationHelperI’m running Rails 0.14.3.

Take a look at how I do it in the FlashHelperPlugin:
http://rubyurl.com/8LU
http://opensvn.csie.org/traccgi/flash_helper_plugin/trac.cgi/file/trunk/init.rb

The problem is that the ApplicationHelper module does not exist at the
moment the plugins are loaded. I too thought ApplicationHelper would
simply be reopened, but it doesn’t work that way.

As suggested by Trevor S. in the RFC Flash Standardization thead
[1], I simply sent the include to ActionView::Base instead.

Hope that helps !

François
http://blog.teksol.info/

[1] http://article.gmane.org/gmane.comp.lang.ruby.rails/28302
[1] http://rubyurl.com/gXj