建设如:
menu.add :label => current_admin_user.full_name do |submenu|
menus.each do |m|
submenu.add :label => m['name'],
:url => "/admin/change/#{m['id']}",
:html_options => {:style => 'float:left;'},
:if => proc { current_admin_user.role?('super_admin') }
end
end
不再适用于1.0pre +。范围中没有current_admin_user。但是在日志中,我看到在添加菜单之前获取管理员用户的请求。
SELECT `admin_users`.* FROM `admin_users` WHERE `admin_users`.`id` = 6 ORDER BY `admin_users`.`id` ASC LIMIT 1
有机会处理它吗?
答案 0 :(得分:0)
仍然可以使用,我只需要传递菜单的ID
menu.add id: 'user_name' label: -> { current_admin_user.full_name } do |submenu|