HELPERS_DIR is missing


#1

In my project, I have

class ApplicationController < ActionController::Base
helper :all
end

module ApplicationHelper
def use_module
### ssss
end
end

class B < ApplicationController
def efd
call_private()
end

private
def call_private()
use_module()
end
end

When I call B::efd(), an error return saying ‘use_module()’ is
undefined !!

I was wonderring why ‘helper :all’ in my application.rb is not working
at all.
Then I find that this method is depend on ‘HELPERS_DIR’ variable.
However, when I type this ‘HELPERS_DIR’ in console, it shows
‘uninitialized constant’ error.

Does anyone has the same problem?


#2

On 31 Oct 2008, at 07:59, boblu removed_email_address@domain.invalid wrote:

end
end
end

When I call B::efd(), an error return saying ‘use_module()’ is
undefined !!

Helper methods are added to views, not controllers

Fred


#3

But sometimes, we need some methods that both used in view and
controller.
Where do you suggest to put them in?

On Oct 31, 5:18 pm, Frederick C. removed_email_address@domain.invalid


#4

On Oct 31, 8:28 am, boblu removed_email_address@domain.invalid wrote:

But sometimes, we need some methods that both used in view and
controller.
Where do you suggest to put them in?

You can make controller methods available to views with helper_method,
or you could have a module that you both include in a controller and
pass to helper (which among other things adds a module to the set of
helpers a view has).

Fred


#5

ok, I see. Thank you.

I just think that “a module that both include in a controller and a
helper” is a little bit complicated then just write that method in
helper and make controller can access it, in the case that the number
of this kind of methods is not a big one.

Emm, maybe this is not the correct ruby way of doing things.
And maybe I should re-orgnize my app structure like your suggestion.
Thank you.

On Oct 31, 5:42 pm, Frederick C. removed_email_address@domain.invalid