1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Regexp.escape(load_path) in add_routing_namespaces initializer [#4442 state:resolved]

Signed-off-by: Michael Koziarski <michael@koziarski.com>
This commit is contained in:
Phil Smith 2010-04-19 12:43:42 -07:00 committed by Michael Koziarski
parent 69bd542d61
commit d03196c89e

View file

@ -166,7 +166,7 @@ module Rails
paths.app.controllers.to_a.each do |load_path| paths.app.controllers.to_a.each do |load_path|
load_path = File.expand_path(load_path) load_path = File.expand_path(load_path)
Dir["#{load_path}/*/**/*_controller.rb"].collect do |path| Dir["#{load_path}/*/**/*_controller.rb"].collect do |path|
namespace = File.dirname(path).sub(/#{load_path}\/?/, '') namespace = File.dirname(path).sub(/#{Regexp.escape(load_path)}\/?/, '')
app.routes.controller_namespaces << namespace unless namespace.empty? app.routes.controller_namespaces << namespace unless namespace.empty?
end end
end end