diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-09 07:50:14 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-09 07:50:14 +0000 |
commit | c8e0e10e28948bce93ea9f28524f917d9e0ea2da (patch) | |
tree | 06888bf6f026e04b46de624e87995b6a7d1527aa /actionpack | |
parent | e3c02d8c66ae3df7a58ba7d76dfc464f26dcff67 (diff) | |
download | rails-c8e0e10e28948bce93ea9f28524f917d9e0ea2da.tar.gz rails-c8e0e10e28948bce93ea9f28524f917d9e0ea2da.tar.bz2 rails-c8e0e10e28948bce93ea9f28524f917d9e0ea2da.zip |
Added documentation for overwrite_params #2146 [Michael Shuerig]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2162 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 0c229fda8d..f62a5502b4 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -425,6 +425,15 @@ module ActionController #:nodoc: # # url_for :controller => 'posts', :action => nil # + # If you explicitly want to create a URL that's almost the same as the current URL, you can do so using the + # :overwrite_params options. Say for your posts you have different views for showing and printing them. + # Then, in the show view, you get the URL for the print view like this + # + # url_for :overwrite_params => { :action => 'print' } + # + # This takes the current URL as is and only exchanges the action. In contrast, <tt>url_for :action => 'print'</tt> + # would have slashed-off the path components are the changed action. + # # Instead of passing an options hash, you can also pass a method reference in the form of a symbol. Consider this example: # # class WeblogController < ActionController::Base |