default_url_options documentation

Jeffrey
Mon, 30 Nov 2009 15:44:53 -0000

The embedded documentation for ActionController#default_url_options()
is incomplete, inaccurate or at least misleading.  Applying it as
shown to an application will cause the automated tests to fail on
argument count mismatches.   And other tests that check host in URLs
may start failing if :host is overwritten.  The patch below corrects
both problems.  It is against Rails 2.3.5.  It probably also applies
to earlier versions.

Jeffrey

--- base.rb~	2009-11-28 17:56:00.000000000 -0600
+++ base.rb	2009-11-30 09:35:43.000000000 -0600
@@ -1062,8 +1062,8 @@
       # Overwrite to implement a number of default options that all
url_for-based methods will use. The default options should come in
       # the form of a hash, just like the one you would use for
url_for directly. Example:
       #
-      #   def default_url_options(options)
-      #     { :project => @project.active? ? @project.url_name :
"unknown" }
+      #   def default_url_options(options = nil)
+      #     super( { :project => @project.active? ?
@project.url_name : "unknown" } )
       #   end
       #
       # As you can infer from the example, this is mostly useful for
situations where you want to centralize dynamic decisions about the

--

You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at