Forum: Ruby on Rails Shared Helpers -- Newbie Help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2953c93b1319b25c96c8cec6fc442d2d?d=identicon&s=25 Mike Halloran (foobarmike)
on 2007-08-01 23:40
(Received via mailing list)
I am trying to make a shared helper. I have searched near and far for
every piece of help, yet I am still stuck. I am assuming it should be
quite easy; I guess just not for me.

# helpers/fun_helper.rb -- Note: this works fine from the
fun_controller
module FunHelper
  def test_foo2
    "test"
  end
end

# test_controller.rb
class TestController < ApplicationController
  helper :fun
end

# views/test/index.rhtml
<html>
<body>
<%= test_foo2 %>
</body>
</html>

I am getting the following error:

>> undefined local variable or method `test_foo2' for  ...

Thank you,

Mike
D69d23d8e811e8ab2a8593380d6ede63?d=identicon&s=25 Jeff Emminger (jemminger)
on 2007-08-03 04:32
(Received via mailing list)
if you want it to be available from anywhere, put it in helpers/
application_helper.rb
This topic is locked and can not be replied to.