Using a helper within another helper?

I am trying to push some view logic into a helper. The thought is that
this is a step towards having the business logic in the helper rather
than the view. However, I’m essentially wrapping the checks around an
eventual call to date_select(). The problem I’m having is that the
application complains that it doesn’t know about date_select(). I’m
sure (or hope) it’s simple, but so far, I haven’t issued the right

To give an example of what I’m doing:
from the view:

<%= format_planned_start_date @plan, 'plan', 'planned_to_start_on', 

‘Planned Start Date’ %>

and from my helper:

require ‘date’

module HtmlHelper
helper :date_helper
include DateHelper

def format_planned_start_date(obj, obj_name, field_name, label)
text = “

<td valign=“top”><label
text += “\n”
if obj[field_name].nil? or < obj[field_name]
text += “”
text += date_select obj_name, field_name
text += “ \n”
text += “



The above gives the error: undefined method `helper’ for
I’ve also tried “require ‘date_helper’” at the top and without the
“helper :date_helper” without success.

I’ll still poke at this, but I’m not seeing the obvious solution.

Answering my own question, I just removed the “helper :date_helper” and
“include DateHelper” lines and it worked. I confused myself because in
earlier version, I had mistakenly wrapped the “date_select” statement in
“<%= … %>” tags, thinking it would be re-evaluated. When it wasn’t, I
initially assumed that DateHelper wasn’t being pulled in. When I
figured out that that wasn’t the issue, I forgot to remove the added

Sorry for the noise (but maybe it will help someone else down the line).

It’s always appreciated when you post an answer to a problem, even if it
is your own question :slight_smile:

Charlie bowman