Removing empty class attribute from @template.content_tag

Hey all,

I have a quick question regarding the @template.content_tag methos when
creating a custom form builder.

Currently have the following method in my AccessibleBuilder class:

def datetime_select(field, options = {})
required = options.delete :required
label = options.delete :label
@template.content_tag(“div”,
@template.content_tag( “span”, Example Label ) +
super,
:class => (required.nil?) ? ‘’ : ‘required’
)
end

calling:

<%= f.datetime_select :dob %>

inside:

<% form_for :person, :builder => AccessibleBuilder do |f| %>

renders the following:

Example Label*: ...

Any ideas how I can add a conditional somewhere to only render the
:class=>"" if the field is required rather than have the empty class=""
attribute?

how about:
:class => ‘required’ if required?

On Jan 24, 9:14 am, Leevi G. [email protected]