Ignore empty resources

This commit is contained in:
Christian Marie 2013-01-24 08:34:51 +09:30
parent 857a1e841f
commit c2ec2fb69b
1 changed files with 2 additions and 1 deletions

View File

@ -11,7 +11,8 @@ module Grape
original_mount mounts
@combined_routes ||= {}
mounts::routes.each do |route|
resource = route.route_path.match('\/(\w*?)[\.\/\(]').captures.first || '/'
resource = route.route_path.match('\/(\w*?)[\.\/\(]').captures.first
next if resource.empty?
@combined_routes[resource.downcase] ||= []
@combined_routes[resource.downcase] << route
end