aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/route_set.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-03-03 17:19:42 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-03-03 17:19:42 -0300
commit44ff0313c121f528a68b3bd21d6c7a96f313e3d3 (patch)
treee66e09302e6b90a81df49ebf13a42e03199575d8 /actionpack/lib/action_dispatch/routing/route_set.rb
parentb0edabf3be07f841781bc0b1743c401e666d2952 (diff)
parent6c14252d2cc28b97ba708971a3ad235537bcdf02 (diff)
downloadrails-44ff0313c121f528a68b3bd21d6c7a96f313e3d3.tar.gz
rails-44ff0313c121f528a68b3bd21d6c7a96f313e3d3.tar.bz2
rails-44ff0313c121f528a68b3bd21d6c7a96f313e3d3.zip
Merge pull request #18775 from yasyf/issue_5122
Fallback to RAILS_RELATIVE_URL_ROOT in `url_for`
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/route_set.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 58b3fff9d7..29853a3474 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -20,6 +20,8 @@ module ActionDispatch
# alias inspect to to_s.
alias inspect to_s
+ mattr_accessor :relative_url_root
+
class Dispatcher < Routing::Endpoint
def initialize(defaults)
@defaults = defaults
@@ -697,7 +699,7 @@ module ActionDispatch
end
def find_script_name(options)
- options.delete(:script_name) || ''
+ options.delete(:script_name) || relative_url_root || ''
end
def path_for(options, route_name = nil)