diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-07-30 14:51:28 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-07-30 14:51:28 -0700 |
commit | 09603275e9f57ca133bd92557c1213cdfa02cff8 (patch) | |
tree | 1c42550cda712d04b8f4e2d86bb757b340e35246 | |
parent | d9108abcad66412f9e8604479cdcc7795a3262b1 (diff) | |
download | rails-09603275e9f57ca133bd92557c1213cdfa02cff8.tar.gz rails-09603275e9f57ca133bd92557c1213cdfa02cff8.tar.bz2 rails-09603275e9f57ca133bd92557c1213cdfa02cff8.zip |
avoid instrospection on the module
we already know what helpers are path helpers, so just iterate through
that list and define the helpers with warnings
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 444c36a72b..6e8016d360 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -160,10 +160,11 @@ module ActionDispatch def path_helpers_module(warn = false) if warn mod = @path_helpers_module + helpers = @path_helpers Module.new do include mod - mod.instance_methods(false).each do |meth| + helpers.each do |meth| define_method("#{meth}_with_warning") do |*args, &block| ActiveSupport::Deprecation.warn("The method `#{meth}` cannot be used here as a full URL is required. Use `#{meth.to_s.sub(/_path$/, '_url')}` instead") send("#{meth}_without_warning", *args, &block) |