<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -532,9 +532,9 @@ module ActionController #:nodoc:
 
       # Returns a URL that has been rewritten according to the options hash and the defined Routes.
       # (For doing a complete redirect, use redirect_to).
-      # &#160;
+      #
       # &lt;tt&gt;url_for&lt;/tt&gt; is used to:
-      # &#160;
+      #
       # All keys given to url_for are forwarded to the Route module, save for the following:
       # * &lt;tt&gt;:anchor&lt;/tt&gt; -- specifies the anchor name to be appended to the path. For example,
       #   &lt;tt&gt;url_for :controller =&gt; 'posts', :action =&gt; 'show', :id =&gt; 10, :anchor =&gt; 'comments'&lt;/tt&gt;</diff>
      <filename>actionpack/lib/action_controller/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -61,9 +61,9 @@ module ActionController
           # if they're using foo_url(:id=&gt;2) it's one 
           # argument, but we don't want to generate /foos/id2
           if number_of_arguments == 1
-            &quot;defined?(request) &amp;&amp; request &amp;&amp; args.size == 1 &amp;&amp; !args.first.is_a?(Hash)&quot;
+            &quot;(!defined?(default_url_options) || default_url_options(nil).blank?) &amp;&amp; defined?(request) &amp;&amp; request &amp;&amp; args.size == 1 &amp;&amp; !args.first.is_a?(Hash)&quot;
           else
-            &quot;defined?(request) &amp;&amp; request &amp;&amp; args.size == #{number_of_arguments}&quot;
+            &quot;(!defined?(default_url_options) || default_url_options(nil).blank?) &amp;&amp; defined?(request) &amp;&amp; request &amp;&amp; args.size == #{number_of_arguments}&quot;
           end
         end
 
@@ -98,7 +98,7 @@ module ActionController
       # argument
       class PositionalArgumentsWithAdditionalParams &lt; PositionalArguments
         def guard_condition
-          &quot;defined?(request) &amp;&amp; request &amp;&amp; args.size == #{route.segment_keys.size + 1} &amp;&amp; !args.last.has_key?(:anchor) &amp;&amp; !args.last.has_key?(:port) &amp;&amp; !args.last.has_key?(:host)&quot;
+          &quot;(!defined?(default_url_options) || default_url_options(nil).blank?) &amp;&amp; defined?(request) &amp;&amp; request &amp;&amp; args.size == #{route.segment_keys.size + 1} &amp;&amp; !args.last.has_key?(:anchor) &amp;&amp; !args.last.has_key?(:port) &amp;&amp; !args.last.has_key?(:host)&quot;
         end
 
         # This case uses almost the same code as positional arguments, </diff>
      <filename>actionpack/lib/action_controller/routing/optimisations.rb</filename>
    </modified>
    <modified>
      <diff>@@ -48,6 +48,15 @@ protected
   
 end
 
+class DefaultUrlOptionsController &lt; ActionController::Base
+  def default_url_options_action
+  end
+
+  def default_url_options(options)
+    { :host =&gt; 'www.override.com', :action =&gt; 'new', :bacon =&gt; 'chunky' }
+  end
+end
+
 class ControllerClassTests &lt; Test::Unit::TestCase
   def test_controller_path
     assert_equal 'empty', EmptyController.controller_path
@@ -134,3 +143,28 @@ class PerformActionTest &lt; Test::Unit::TestCase
     assert_response 404
   end
 end
+
+class DefaultUrlOptionsTest &lt; Test::Unit::TestCase
+  def setup
+    @controller = DefaultUrlOptionsController.new
+
+    @request    = ActionController::TestRequest.new
+    @response   = ActionController::TestResponse.new
+
+    @request.host = 'www.example.com'
+  end
+
+  def test_default_url_options_are_used_if_set
+    ActionController::Routing::Routes.draw do |map|
+      map.default_url_options 'default_url_options', :controller =&gt; 'default_url_options'
+      map.connect ':controller/:action/:id'
+    end
+
+    get :default_url_options_action # Make a dummy request so that the controller is initialized properly.
+
+    assert_equal 'http://www.override.com/default_url_options/new?bacon=chunky', @controller.url_for(:controller =&gt; 'default_url_options')
+    assert_equal 'http://www.override.com/default_url_options?bacon=chunky', @controller.send(:default_url_options_url)
+  ensure
+    ActionController::Routing::Routes.load!
+  end
+end
\ No newline at end of file</diff>
      <filename>actionpack/test/controller/base_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>437f918646fd141fd57350f55a8890b18ebfb148</id>
    </parent>
  </parents>
  <author>
    <name>Cheah Chu Yeow</name>
    <email>chuyeow@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/6a6b4392c16c665eb713705f2b38e959a658eeef</url>
  <id>6a6b4392c16c665eb713705f2b38e959a658eeef</id>
  <committed-date>2008-05-03T17:49:44-07:00</committed-date>
  <authored-date>2008-04-19T21:57:36-07:00</authored-date>
  <message>Ensure that default_url_options, if defined, are used in named routes.

Signed-off-by: Michael Koziarski &lt;michael@koziarski.com&gt;

[#22 state:resolved]</message>
  <tree>e5769a86f89bcfb084726be42bad07d365dee5ac</tree>
  <committer>
    <name>Michael Koziarski</name>
    <email>michael@koziarski.com</email>
  </committer>
</commit>
