views:

44

answers:

1

Hi,

Here below the start of my menu_builder method in the applicationhelper (in the view: <%= menu_builder(@page); %>):

def menu_builder(page)
  items = [ "home", "faq", "store" ]
  content = ""
  items.each do |i|
    content << content_tag(:a, "#{i.capitalize}", :href => "/#{i}" )
  end
  return content
end

I would like to render links not tags. I should miss somthing here but I don't find..

Thanks for your help!

A: 

You can fix it like this:

def menu_builder(page)
  items = [ "home", "faq", "store" ]
  content = ""
  items.each do |i|
    content << content_tag(:a, "#{i.capitalize}", :href => "/#{i}" )
  end
  content.html_safe
end

Or modify your template like this:

<%= raw menu_builder %>

Use any.

floatless
:) Thanks so much!!
benoitr