<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -67,10 +67,9 @@ module ActionController
         options = options.dup
 
         if options[:namespace]
-          options[:controller] = &quot;#{options[:path_prefix]}/#{options[:controller]}&quot;
+          options[:controller] = &quot;#{options.delete(:namespace).sub(/\/$/, '')}/#{options[:controller]}&quot;
           options.delete(:path_prefix)
           options.delete(:name_prefix)
-          options.delete(:namespace)
         end
 
         requirements = (options.delete(:requirements) || {}).dup</diff>
      <filename>actionpack/lib/action_controller/routing/builder.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2039,6 +2039,26 @@ uses_mocha 'LegacyRouteSet, Route, RouteSet and RouteLoading' do
       Object.send(:remove_const, :Api)
     end
 
+    def test_namespace_with_path_prefix
+      Object.const_set(:Api, Module.new { |m| m.const_set(:ProductsController, Class.new) })
+
+      set.draw do |map|
+
+        map.namespace 'api', :path_prefix =&gt; 'prefix' do |api|
+          api.route 'inventory', :controller =&gt; &quot;products&quot;, :action =&gt; 'inventory'
+        end
+
+      end
+
+      request.path = &quot;/prefix/inventory&quot;
+      request.method = :get
+      assert_nothing_raised { set.recognize(request) }
+      assert_equal(&quot;api/products&quot;, request.path_parameters[:controller])
+      assert_equal(&quot;inventory&quot;, request.path_parameters[:action])
+    ensure
+      Object.send(:remove_const, :Api)
+    end
+
     def test_generate_finds_best_fit
       set.draw do |map|
         map.connect &quot;/people&quot;, :controller =&gt; &quot;people&quot;, :action =&gt; &quot;index&quot;</diff>
      <filename>actionpack/test/controller/routing_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d20e8dd2207a848e2712c19ad38d6abb6f98ca07</id>
    </parent>
  </parents>
  <author>
    <name>Tarmo T&#228;nav</name>
    <email>tarmo@itech.ee</email>
  </author>
  <url>http://github.com/rails/rails/commit/a37d065f85941e1fe746dff4d42f015e1618834f</url>
  <id>a37d065f85941e1fe746dff4d42f015e1618834f</id>
  <committed-date>2008-07-03T08:11:50-07:00</committed-date>
  <authored-date>2008-07-03T07:49:12-07:00</authored-date>
  <message>Use :namespace instead of :path_prefix for finding controller. [#544 state:resolved]

:namespace is supposed to be the module where controller exists.
:path_prefix can contain anything, including variables, which
makes it unsuitable for determining the module for a controller.

Signed-off-by: Pratik Naik &lt;pratiknaik@gmail.com&gt;</message>
  <tree>2e498068f1ec02c083150c2471243c5114bf3b1d</tree>
  <committer>
    <name>Pratik Naik</name>
    <email>pratiknaik@gmail.com</email>
  </committer>
</commit>
