lib/express_admin/menu.rb in express_admin-1.1.0 vs lib/express_admin/menu.rb in express_admin-1.2.0

- old
+ new

@@ -24,11 +24,16 @@ # Accepts an addon_name such as :express_admin or a path to a yaml file # containing a menu definition. def self.[](addon_name) @menus ||= {} @menus[addon_name.to_sym] ||= begin - addon_path = Gem.loaded_specs[addon_name].full_gem_path if addon_name.to_s.match(/^\w+$/) - menu_yml_path = File.join(addon_path, 'config', 'menu.yml') + menu_yml_path = + if addon_name.eql?('admin') + File.join(Rails.root, 'config', 'menu.yml') + else + addon_path = Gem.loaded_specs[addon_name].full_gem_path if addon_name.to_s.match(/^\w+$/) + File.join(addon_path, 'config', 'menu.yml') + end from(menu_yml_path) end end def self.from(yaml_path)