Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActionController::Base.helpers proxy fails for helper_method-helpers

#3601

In controller:

  class ApplicationController < ActionController::Base
  
    helper_method :quack!

    protected

      def quack!
        "Quack, quack!"
      end

  end

In view:

  = quack!  # => "Quack, quack!"
  = ActionController::Base.helpers.quack!  # => undefined method `quack!' for #<ActionView::Base:0x1058925c8>

Weird. I would like to state that I think this should work - I actually really needs to access helpers from outside of ActionView template in a few cases. I'm not sure why it's not working, because it seems like it was supposed to work according to the source:

http://github.com/rails/rails/blob/2-3-stable/actionpack/lib/action...

Reported by Jonas Grimfelt · December 19th, 2009 @ 09:14 PM

State: invalid
Milestone: 3.x
Assigned to: nobody
Importance: Low

Activity

  1. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to open
    • Milestone set to 3.x
    • Importance changed from to Low

    This is still an issue in Rails 3.

    October 8th, 2010 @ 12:24 PM

  2. José Valim
    José Valim
    • State changed from open to invalid

    This will not work. If you define the helper_method :quack in ApplicationController, you need to access it as ApplicationController.helpers.quack and not as ActionController::Base.helpers.quack.

    October 8th, 2010 @ 12:36 PM