Sha256: 2ee49ba9a5a1567011b18f352e0a1bc0838c25209505718ef1b11b6e28ad655c
Contents?: true
Size: 777 Bytes
Versions: 6
Compression:
Stored size: 777 Bytes
Contents
module Ecom module Core class MenusController < ApplicationController def index user = current_user roles = user.user_roles app_module = roles[0].application_module menus = [] roles.each do |role| menu_list = role.menus.where(parent: nil, application_module: app_module) menu_list.each do |menu| children = [] menu.children.order(:label).each do |child| if role.menus.include? child children << { label: child.label, icon: child.icon, route: child.route } end end menus << { label: menu.label, icon: menu.icon, children: children } end end render json: menus end end end end
Version data entries
6 entries across 6 versions & 1 rubygems