Skip to content

Commit 34e3807

Browse files
committed
Remove deprecated usage of string keys in URL helpers
1 parent e4e1fd7 commit 34e3807

File tree

3 files changed

+5
-37
lines changed

3 files changed

+5
-37
lines changed

actionpack/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Remove deprecated usage of string keys in URL helpers.
2+
3+
*Rafael Mendonça França*
4+
15
* Remove deprecated `only_path` option on `*_path` helpers.
26

37
*Rafael Mendonça França*

actionpack/lib/action_dispatch/routing/route_set.rb

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def call(t, args, inner_options)
244244
controller_options = t.url_options
245245
options = controller_options.merge @options
246246
hash = handle_positional_args(controller_options,
247-
deprecate_string_options(inner_options) || {},
247+
inner_options || {},
248248
args,
249249
options,
250250
@segment_keys)
@@ -272,22 +272,6 @@ def handle_positional_args(controller_options, inner_options, args, result, path
272272

273273
result.merge!(inner_options)
274274
end
275-
276-
DEPRECATED_STRING_OPTIONS = %w[controller action]
277-
278-
def deprecate_string_options(options)
279-
options ||= {}
280-
deprecated_string_options = options.keys & DEPRECATED_STRING_OPTIONS
281-
if deprecated_string_options.any?
282-
msg = "Calling URL helpers with string keys #{deprecated_string_options.join(", ")} is deprecated. Use symbols instead."
283-
ActiveSupport::Deprecation.warn(msg)
284-
deprecated_string_options.each do |option|
285-
value = options.delete(option)
286-
options[option.to_sym] = value
287-
end
288-
end
289-
options
290-
end
291275
end
292276

293277
private

actionpack/test/dispatch/routing/route_set_test.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -128,26 +128,6 @@ def call(env)
128128
assert_equal '/a/users/1', url_helpers.user_path(1, foo: 'a')
129129
end
130130

131-
test "stringified controller and action keys are properly symbolized" do
132-
draw do
133-
root 'foo#bar'
134-
end
135-
136-
assert_deprecated do
137-
assert_equal '/', url_helpers.root_path('controller' => 'foo', 'action' => 'bar')
138-
end
139-
end
140-
141-
test "mix of string and symbol keys are properly symbolized" do
142-
draw do
143-
root 'foo#bar'
144-
end
145-
146-
assert_deprecated do
147-
assert_equal '/', url_helpers.root_path('controller' => 'foo', :action => 'bar')
148-
end
149-
end
150-
151131
private
152132
def draw(&block)
153133
@set.draw(&block)

0 commit comments

Comments
 (0)