I’m stuck trying to get this helper to work properly. This is what I have but it assuredly does not work.
def registration_link step, step_number
path = registration_path step
classes = []
classes << 'current' if current_step?(step)
# how do I add the following line to appear before the link ?
step_icon = "<span class='step_number'>#{step_number}</span>"
link_to step_icon + t("registration.menu.#{step}"), path, :class => classes.join(' ')
end
I am trying to get step_icon to appear within the link_to and before the word generated by t("registration.menu.#{step}")
It seems I can sometimes get in there, but the tags <> are sanitized as well..
Any ideas?
link_to can accept a block to link to, normally like so:
So you could (probably needs refactoring):
to render your strings as html, rather than escaped strings, you add
.html_safeafter.Alternatively, you could create a tag like so