aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-04-09 18:26:23 +0200
committerXavier Noria <fxn@hashref.com>2012-04-09 18:26:47 +0200
commitb125db84a4353a7f9c4bc93658a987653a602bbe (patch)
treef8176976f670bdafd5af2fa537d7222290dba76b /railties
parente7671b5b7f941b99b940131f06fb78ad245375d7 (diff)
downloadrails-b125db84a4353a7f9c4bc93658a987653a602bbe.tar.gz
rails-b125db84a4353a7f9c4bc93658a987653a602bbe.tar.bz2
rails-b125db84a4353a7f9c4bc93658a987653a602bbe.zip
rewords the section about default_url_options in the Action Controller Overview guide
Diffstat (limited to 'railties')
-rw-r--r--railties/guides/source/action_controller_overview.textile7
1 files changed, 4 insertions, 3 deletions
diff --git a/railties/guides/source/action_controller_overview.textile b/railties/guides/source/action_controller_overview.textile
index 99a3480e6d..baa83a0f9c 100644
--- a/railties/guides/source/action_controller_overview.textile
+++ b/railties/guides/source/action_controller_overview.textile
@@ -148,18 +148,19 @@ In this case, when a user opens the URL +/clients/active+, +params[:status]+ wil
h4. +default_url_options+
-You can set global default parameters that will be used when generating URLs with +default_url_options+. To do this, define a method with that name in your controller:
+You can set global default parameters for URL generation by defining a method called +default_url_options+ in your controller. Such a method must return a hash with the desired defaults, whose keys must be symbols:
<ruby>
class ApplicationController < ActionController::Base
- # This method must return a hash with symbolized keys.
def default_url_options
{:locale => I18n.locale}
end
end
</ruby>
-These options will be used as a starting-point when generating URLs, so it's possible they'll be overridden by +url_for+. Because this method is defined in the controller, you can define it on +ApplicationController+ so it would be used for all URL generation, or you could define it on only one controller for all URLs generated there.
+These options will be used as a starting point when generating URLs, so it's possible they'll be overridden by the options passed in +url_for+ calls.
+
+If you define +default_url_options+ in +ApplicationController+, as in the example above, it would be used for all URL generation. The method can also be defined in one specific controller, in which case it only affects URLs generated there.
h3. Session