diff --git a/lib/brakeman/processors/lib/rails3_route_processor.rb b/lib/brakeman/processors/lib/rails3_route_processor.rb index 9a0088ab8a83cc8cb01662a3f221855bfb4e921a..b40ff2eafe9a050852709d3e0ac7cb85488ce03e 100644 --- a/lib/brakeman/processors/lib/rails3_route_processor.rb +++ b/lib/brakeman/processors/lib/rails3_route_processor.rb @@ -255,13 +255,16 @@ class Brakeman::Rails3RoutesProcessor < Brakeman::BaseProcessor end def process_controller_block exp - self.current_controller = exp.block_call.first_arg.value + if string? exp or symbol? exp + self.current_controller = exp.block_call.first_arg.value - in_controller_block do - process exp[-1] if exp[-1] + in_controller_block do + process exp[-1] if exp[-1] + end + + @current_controller = nil end - @current_controller = nil exp end diff --git a/test/apps/rails3/config/routes.rb b/test/apps/rails3/config/routes.rb index 8f72e9172b67a3cf3d61cfd299b17747d8ac097e..3cc9eb7ff937292ffd54e9c0198d9af58304ead1 100644 --- a/test/apps/rails3/config/routes.rb +++ b/test/apps/rails3/config/routes.rb @@ -39,6 +39,10 @@ Rails3::Application.routes.draw do get "home/test_dynamic_render" + controller "a#{controller_name}" do + get "some_route" + end + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/test/tests/rails3.rb b/test/tests/rails3.rb index 1f139db6091db4742befe567af97c8b92423b9a4..8b90e1c2a42c145d085f4b484d0abd0d7ee95f92 100644 --- a/test/tests/rails3.rb +++ b/test/tests/rails3.rb @@ -713,7 +713,7 @@ class Rails3Tests < Test::Unit::TestCase def test_default_routes assert_warning :warning_type => "Default Routes", - :line => 97, + :line => 101, :message => /All public methods in controllers are available as actions/, :file => /routes\.rb/ end