lib/express_admin/commandable.rb in express_admin-1.7.32 vs lib/express_admin/commandable.rb in express_admin-1.8.0
- old
+ new
@@ -27,10 +27,16 @@
controller_class = nil
begin
controller_class = "#{modules.join("/").classify.pluralize}Controller".constantize
rescue NameError => e
# if plural fails, use singular
- controller_class = "#{modules.join("/").classify}Controller".constantize
+ begin
+ controller_class = "#{modules.join("/").classify}Controller".constantize
+ rescue NameError => e2
+ # if we get here, the first exception wasn't what we thought
+ # it was something else and we should politely let the developer know
+ raise e
+ end
end
if controller_class.respond_to?(:resource_class)
resource_class = controller_class.resource_class
if resource_class.respond_to?(:commands)
resource_class.commands.each do |action|