aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-11-24 19:18:01 -0700
committerSean Griffin <sean@thoughtbot.com>2014-11-24 19:18:01 -0700
commit9545e6edc7a916465c8345afa4d48f29b8687a26 (patch)
treea4fc6ec89968fedc6a84ce18edfbb52307b3f32b /actionpack/lib/action_dispatch/routing
parenta381820f60588ed356b4abb365e646dff0eaff73 (diff)
parent4d84922840deb89754f5b5fb61ebea0aeadc52df (diff)
downloadrails-9545e6edc7a916465c8345afa4d48f29b8687a26.tar.gz
rails-9545e6edc7a916465c8345afa4d48f29b8687a26.tar.bz2
rails-9545e6edc7a916465c8345afa4d48f29b8687a26.zip
Merge branch 'deprecate-string-options-in-url-helpers'
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index d2ae2a496f..dcfb819906 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -271,7 +271,7 @@ module ActionDispatch
controller_options = t.url_options
options = controller_options.merge @options
hash = handle_positional_args(controller_options,
- inner_options || {},
+ deprecate_string_options(inner_options) || {},
args,
options,
@segment_keys)
@@ -293,6 +293,22 @@ module ActionDispatch
result.merge!(inner_options)
end
+
+ DEPRECATED_STRING_OPTIONS = %w[controller action]
+
+ def deprecate_string_options(options)
+ options ||= {}
+ deprecated_string_options = options.keys & DEPRECATED_STRING_OPTIONS
+ if deprecated_string_options.any?
+ msg = "Calling URL helpers with string keys #{deprecated_string_options.join(", ")} is deprecated. Use symbols instead."
+ ActiveSupport::Deprecation.warn(msg)
+ deprecated_string_options.each do |option|
+ value = options.delete(option)
+ options[option.to_sym] = value
+ end
+ end
+ options
+ end
end
private