Skip to content

Commit 71c7313

Browse files
authored
Merge pull request rails#50298 from bensheldon/routes_proxy_eval
Do not instance_eval method into RoutesProxy
2 parents ab8f5c9 + 4c0ecea commit 71c7313

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

actionpack/lib/action_dispatch/routing/routes_proxy.rb

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,18 @@ def respond_to_missing?(method, _)
2929

3030
def method_missing(method, *args)
3131
if @helpers.respond_to?(method)
32-
instance_eval <<-RUBY, __FILE__, __LINE__ + 1
33-
def #{method}(*args)
34-
options = args.extract_options!
35-
options = url_options.merge((options || {}).symbolize_keys)
32+
options = args.extract_options!
33+
options = url_options.merge((options || {}).symbolize_keys)
3634

37-
if @script_namer
38-
options[:script_name] = merge_script_names(
39-
options[:script_name],
40-
@script_namer.call(options)
41-
)
42-
end
35+
if @script_namer
36+
options[:script_name] = merge_script_names(
37+
options[:script_name],
38+
@script_namer.call(options)
39+
)
40+
end
4341

44-
args << options
45-
@helpers.#{method}(*args)
46-
end
47-
RUBY
48-
public_send(method, *args)
42+
args << options
43+
@helpers.public_send(method, *args)
4944
else
5045
super
5146
end

0 commit comments

Comments
 (0)