aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2010-07-09 01:22:18 +0200
committerPiotr Sarnacki <drogus@gmail.com>2010-09-03 22:59:06 +0200
commit8a077089d9b7aa89cb56ef754b4540f411453375 (patch)
tree92cf07a73c937180830c786876c506f07c851284 /actionpack/lib/action_dispatch
parentb1e5e233fabe8f75ebd06e7e08c15f0eeddbae79 (diff)
downloadrails-8a077089d9b7aa89cb56ef754b4540f411453375.tar.gz
rails-8a077089d9b7aa89cb56ef754b4540f411453375.tar.bz2
rails-8a077089d9b7aa89cb56ef754b4540f411453375.zip
Get rid of :skip_prefix options in routes
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 7519d74183..6f182ae652 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -452,7 +452,7 @@ module ActionDispatch
Generator.new(options, recall, self, extras).generate
end
- RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :port, :trailing_slash, :script_name, :skip_prefix, :routes]
+ RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :port, :trailing_slash, :script_name, :routes]
def _generate_prefix(options = {})
nil
@@ -478,15 +478,12 @@ module ActionDispatch
rewritten_url << ":#{options.delete(:port)}" if options.key?(:port)
end
- path = [options.delete(:script_name)]
- if !options.delete(:skip_prefix)
- path << _generate_prefix(options)
- end
+ script_name = options.delete(:script_name)
+ path = (script_name.blank? ? _generate_prefix(options) : script_name).to_s
path_options = options.except(*RESERVED_OPTIONS)
path_options = yield(path_options) if block_given?
path << generate(path_options, path_segments || {})
- path = path.compact.join ''
# ROUTES TODO: This can be called directly, so script_name should probably be set in the routes
rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path)