2

I've been attempting to add a helper method to my ruby gem for use with Rails 3.

Here is an example of what I am attempting to achieve:

module MyHelper

def my_method
    render :text => "Hello World!"
end

end

I've tried prepending MyHelper.rb with:

ActionView::Base.send :include, MyHelper

And I've also tried adding the above line to an init.rb file without success.

Here is the code from the view... Maybe I am implementing it wrong?

<%= yield my_method %>

Any suggestions?

1 Answers1

1

You might want to try

ActionView::Helper.send :include, MyHelper
Chirantan
  • 14,264
  • 7
  • 45
  • 71