提交 64432461 编写于 作者: J Justin Collins

Ignore resource routes if default routes already

fixes bug where resource routes attempted to merge into
:allow_all_actions
上级 a059fed8
......@@ -23,12 +23,19 @@ module Brakeman::RouteHelper
#Add default routes
def add_resources_routes
@tracker.routes[@current_controller].merge [:index, :new, :create, :show, :edit, :update, :destroy]
end
existing_routes = @tracker.routes[@current_controller]
unless existing_routes.is_a? Array and existing_routes.first == :allow_all_actions
existing_routes.merge [:index, :new, :create, :show, :edit, :update, :destroy]
end
end
#Add default routes minus :index
def add_resource_routes
@tracker.routes[@current_controller].merge [:new, :create, :show, :edit, :update, :destroy]
existing_routes = @tracker.routes[@current_controller]
unless existing_routes.is_a? Array and existing_routes.first == :allow_all_actions
existing_routes.merge [:new, :create, :show, :edit, :update, :destroy]
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册