This project is archived and is in readonly mode.

#3601 ✓invalid
Jonas Grimfelt

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

Reported by Jonas Grimfelt | December 19th, 2009 @ 09:14 PM | in 3.x

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...

Comments and changes to this ticket

  • Rohit Arondekar

    Rohit Arondekar October 8th, 2010 @ 12:24 PM

    • State changed from “new” to “open”
    • Milestone set to 3.x
    • Importance changed from “” to “Low”

    This is still an issue in Rails 3.

  • José Valim

    José Valim October 8th, 2010 @ 12:36 PM

    • 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.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages