diff options
author | Andrew White <andrew.white@unboxed.co> | 2017-02-21 12:49:25 +0000 |
---|---|---|
committer | Andrew White <andrew.white@unboxed.co> | 2017-02-21 15:30:47 +0000 |
commit | c116eaf2217abbc83ad76ac09c4fb89e033e1cdd (patch) | |
tree | 36ccb62c9606f2d016b29a7895d2de013a4134d0 /actionpack/lib | |
parent | 81a6761af2b20183c78853caa4daea4ccf6b4cb7 (diff) | |
download | rails-c116eaf2217abbc83ad76ac09c4fb89e033e1cdd.tar.gz rails-c116eaf2217abbc83ad76ac09c4fb89e033e1cdd.tar.bz2 rails-c116eaf2217abbc83ad76ac09c4fb89e033e1cdd.zip |
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.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 8 |
1 files changed, 4 insertions, 4 deletions
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 |