aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-05-13 15:35:41 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-05-13 15:35:41 -0700
commit33d6e3be623d4dbcec077e62699272cbdcd23f37 (patch)
treefe5a90ad364f0b8968a129ff42ee4eccc465eb01
parent67f815af058cf0a4dbf1dcea50eec2585cd7ee3a (diff)
downloadrails-33d6e3be623d4dbcec077e62699272cbdcd23f37.tar.gz
rails-33d6e3be623d4dbcec077e62699272cbdcd23f37.tar.bz2
rails-33d6e3be623d4dbcec077e62699272cbdcd23f37.zip
drop || test for cases that do not need it
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb4
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb6
2 files changed, 6 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index d75ea9394c..58c7f5330e 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -580,11 +580,13 @@ module ActionDispatch
app.routes.define_mounted_helper(name)
app.routes.extend Module.new {
def mounted?; true; end
- define_method :_generate_prefix do |options|
+ define_method :find_script_name do |options|
+ super(options) || begin
prefix_options = options.slice(*_route.segment_keys)
# we must actually delete prefix segment keys to avoid passing them to next url_for
_route.segment_keys.each { |k| options.delete(k) }
_routes.url_helpers.send("#{name}_path", prefix_options)
+ end
end
}
end
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 6fc799c0d2..8aad5907ba 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -641,8 +641,8 @@ module ActionDispatch
!mounted? && default_url_options.empty?
end
- def _generate_prefix(options)
- nil
+ def find_script_name(options)
+ options.delete :script_name
end
# The +options+ argument must be a hash whose keys are *symbols*.
@@ -659,7 +659,7 @@ module ActionDispatch
recall = options.delete(:_recall)
original_script_name = options.delete(:original_script_name)
- script_name = options.delete(:script_name) || _generate_prefix(options)
+ script_name = find_script_name options
if script_name && original_script_name
script_name = original_script_name + script_name