aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-14 11:55:50 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-14 11:55:50 -0700
commitb10b279b97b0174d6e157d03845921f04f19d0ad (patch)
tree25a73306226a5d8ba3108168c4f43c9181278215 /actionpack/lib/action_dispatch/routing
parentb6146b0d967c34f104c7301ecc62b2d866bbb5c0 (diff)
downloadrails-b10b279b97b0174d6e157d03845921f04f19d0ad.tar.gz
rails-b10b279b97b0174d6e157d03845921f04f19d0ad.tar.bz2
rails-b10b279b97b0174d6e157d03845921f04f19d0ad.zip
deprecate passing a string for both the beginning path and :path option
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index c4572916ac..2cd13b8696 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -5,6 +5,7 @@ require 'active_support/core_ext/enumerable'
require 'active_support/core_ext/array/extract_options'
require 'active_support/core_ext/module/remove_method'
require 'active_support/inflector'
+require 'active_support/deprecation'
require 'action_dispatch/routing/redirection'
require 'action_dispatch/routing/endpoint'
@@ -1538,7 +1539,21 @@ module ActionDispatch
path_types = paths.group_by(&:class)
path_types.fetch(String, []).each do |_path|
route_options = options.dup
- process_path(route_options, controller, _path, option_path || _path, to, via, formatted, anchor, options_constraints)
+ if _path && option_path
+ ActiveSupport::Deprecation.warn <<-eowarn
+Specifying strings for both :path and the route path is deprecated. Change things like this:
+
+ match #{_path.inspect}, :path => #{option_path.inspect}
+
+to this:
+
+ match #{option_path.inspect}, :as => #{_path.inspect}, :action => #{path.inspect}
+ eowarn
+ route_options[:action] = _path
+ route_options[:as] = _path
+ _path = option_path
+ end
+ process_path(route_options, controller, _path, _path, to, via, formatted, anchor, options_constraints)
end
path_types.fetch(Symbol, []).each do |action|