in a view, call a helper method from another controller

I need to call a helper method from another controller. The catch is that I have the same method name defined in my current controllers helper.

Here the partial will use the the default column_list defined in my helper. <%=render 'companies/company', :object => @company%> For example, if I change the call to specify the method, it still runs great: <%=render 'companies/company', :object => @company, :locals => {:column_list => method(:column_list)}%>

Here I want to use another's helper column_list: <%=render 'companies/companies', :object => @customers_employees, :locals => {:column_list => CustomersEmployeesController.new.method(:column_list)} %>

I get this error: undefined method `column_list' for class `CustomersEmployeesController'

How can I pass the reference to the right helper method?

helper_methods are not methods of the controller - they are methods of the associated helper module (usually CustomerEmployeesHelper in this case). Does that help ?

Fred

I realize that. I want to call a helper method column_list available when running CustomersEmployeesController. CustomersEmployeesController inherits from CompaniesController, which includes the helper method needed. I cannot hardcode the file name of the module where this method is, because I might redefine it later in CustomersEmployeesHelper and that would drive crazy the maintenance programmer when will find that normal mechanisms of inheritance don't work.

I thought that instantiating CustomersEmployeesController will include automatically his Helper module, but it appears it doesn't.

Why not put the relevant helper methods in a module that both controllers use ?

Fred