Module: MenuHelper

Defined in:
app/helpers/menu_helper.rb

Instance Method Summary collapse

Instance Method Details



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/menu_helper.rb', line 2

def menu(name)
  menu = Menu.find_or_create_by(name: name)
  html = ''

  menu.links.each do |l|
    if l.new_tab?
      html << link_to(l.title, l.url, target: '_blank')

    else
      html << link_to(l.title, l.url)

    end
  end

  html.html_safe
end