Skip to content

Commit

Permalink
options could be of any kind of Hash (Hash, HashWithIndifferentAccess…
Browse files Browse the repository at this point in the history
… or OrderedHash) this way we keep the properties of the options passed as an argument
  • Loading branch information
spastorino authored and jeremy committed Jul 22, 2010
1 parent a78547a commit a1e795f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/routing/route_set.rb
Expand Up @@ -454,7 +454,7 @@ def generate(options, recall = {}, extras = false)

def url_for(options)
finalize!
options = default_url_options.merge(options || {})
options = (options || {}).reverse_merge!(default_url_options)

handle_positional_args(options)

Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/routing/url_for.rb
Expand Up @@ -129,7 +129,7 @@ def url_for(options = nil)
when String
options
when nil, Hash
_routes.url_for(url_options.merge((options || {}).symbolize_keys))
_routes.url_for((options || {}).reverse_merge!(url_options).symbolize_keys)
else
polymorphic_url(options)
end
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/helpers/url_helper.rb
Expand Up @@ -95,7 +95,7 @@ def url_for(options = {})
when String
options
when Hash
options = { :only_path => options[:host].nil? }.update(options.symbolize_keys)
options = options.symbolize_keys.reverse_merge!(:only_path => options[:host].nil?)
super
when :back
controller.request.env["HTTP_REFERER"] || 'javascript:history.back()'
Expand Down

0 comments on commit a1e795f

Please sign in to comment.