lib/express_admin/menu.rb in express_admin-1.7.27 vs lib/express_admin/menu.rb in express_admin-1.7.28
- old
+ new
@@ -25,14 +25,13 @@
# containing a menu definition.
def self.[](addon_name)
@menus ||= {}
@menus[addon_name.to_sym] ||= begin
menu_yml_path =
- if addon_name.eql?('admin')
- File.join(Rails.root, 'config', 'menu.yml')
+ if addon = Gem.loaded_specs[addon_name]
+ File.join(addon.full_gem_path, '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')
+ File.join(Rails.root, 'config', 'menu.yml')
end
from(menu_yml_path)
end
end