Permalink
Browse files

Merge pull request #5783 from rafaelfranca/default_url_options

Document that default_url_options must return a hash with symbolized keys
  • Loading branch information...
2 parents 500c9a1 + c9945b3 commit 4c1dcb05373f667be90a69bfb2b642efe75e9d18 @spastorino spastorino committed Apr 9, 2012
@@ -45,7 +45,7 @@ def from_view
render :inline => "<%= #{params[:route]} %>"
end
- def default_url_options(options = nil)
+ def default_url_options
{ :host => 'www.override.com', :action => 'new', :locale => 'en' }
end
end
@@ -566,7 +566,7 @@ def test_url_for_nil_returns_current_path
def test_named_route_should_show_host_and_path_using_controller_default_url_options
class << @controller
- def default_url_options(options = nil)
+ def default_url_options
{:host => 'testtwo.host'}
end
end
@@ -152,8 +152,8 @@ You can set global default parameters that will be used when generating URLs wit
<ruby>
class ApplicationController < ActionController::Base
- # The options parameter is the hash passed in to 'url_for'
- def default_url_options(options)
+ # This method must return a hash with symbolized keys.
+ def default_url_options
{:locale => I18n.locale}
end
end

0 comments on commit 4c1dcb0

Please sign in to comment.