From c116eaf2217abbc83ad76ac09c4fb89e033e1cdd Mon Sep 17 00:00:00 2001 From: Andrew White Date: Tue, 21 Feb 2017 12:49:25 +0000 Subject: Prefer remove_method over undef_method Using `undef_method` means that when a route is removed any other implementations of that method in the ancestor chain are inaccessible so instead use `remove_method` which restores access to the ancestor. --- actionpack/lib/action_dispatch/routing/route_set.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing/route_set.rb') diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 8bdf0d1a53..7cab421887 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -89,11 +89,11 @@ module ActionDispatch def clear! @path_helpers.each do |helper| - @path_helpers_module.send :undef_method, helper + @path_helpers_module.send :remove_method, helper end @url_helpers.each do |helper| - @url_helpers_module.send :undef_method, helper + @url_helpers_module.send :remove_method, helper end @custom_helpers.each do |helper| @@ -101,11 +101,11 @@ module ActionDispatch url_name = :"#{helper}_url" if @path_helpers_module.method_defined?(path_name) - @path_helpers_module.send :undef_method, path_name + @path_helpers_module.send :remove_method, path_name end if @url_helpers_module.method_defined?(url_name) - @url_helpers_module.send :undef_method, url_name + @url_helpers_module.send :remove_method, url_name end end -- cgit v1.2.3