1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

drop || test for cases that do not need it

This commit is contained in:
Aaron Patterson 2014-05-13 15:35:41 -07:00
parent 67f815af05
commit 33d6e3be62
2 changed files with 6 additions and 4 deletions

View file

@ -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

View file

@ -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