aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-26 13:31:01 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-26 13:31:01 +0000
commita5b55c6b9f8e09bb0936b30f5c096b28bafe00a4 (patch)
tree1aa1f2180c9755d9241973d29d7d9fc968d53351 /actionpack/lib/action_controller
parentabfa14d825c8eeb8e1ba33b6c9168445ec48f248 (diff)
downloadrails-a5b55c6b9f8e09bb0936b30f5c096b28bafe00a4.tar.gz
rails-a5b55c6b9f8e09bb0936b30f5c096b28bafe00a4.tar.bz2
rails-a5b55c6b9f8e09bb0936b30f5c096b28bafe00a4.zip
Removed old UrlWriter methods that are no longer in use after Routes #942
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@999 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/url_rewriter.rb49
1 files changed, 4 insertions, 45 deletions
diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb
index 3e6ccf7a06..89245ceb37 100644
--- a/actionpack/lib/action_controller/url_rewriter.rb
+++ b/actionpack/lib/action_controller/url_rewriter.rb
@@ -2,10 +2,9 @@ module ActionController
# Rewrites URLs for Base.redirect_to and Base.url_for in the controller.
class UrlRewriter #:nodoc:
- RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :application_prefix]
+ RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol]
def initialize(request, parameters)
@request, @parameters = request, parameters
- @rewritten_path = @request.path ? @request.path.dup : ""
end
def rewrite(options = {})
@@ -19,13 +18,13 @@ module ActionController
alias_method :to_s, :to_str
private
- def rewrite_url(path, options)
+ def rewrite_url(path, options)
rewritten_url = ""
rewritten_url << (options[:protocol] || @request.protocol) unless options[:only_path]
rewritten_url << (options[:host] || @request.host_with_port) unless options[:only_path]
- rewritten_url << (options[:application_prefix] || @request.relative_url_root)
+ rewritten_url << @request.relative_url_root.to_s
rewritten_url << path
rewritten_url << "##{options[:anchor]}" if options[:anchor]
@@ -34,7 +33,7 @@ module ActionController
def rewrite_path(options)
options = options.symbolize_keys
- options.update((options[:params]).symbolize_keys) if options[:params]
+ options.update((options[:params] || {}).symbolize_keys)
RESERVED_OPTIONS.each {|k| options.delete k}
path, extras = Routing::Routes.generate(options, @request)
@@ -45,46 +44,6 @@ module ActionController
return path
end
- def action_name(options, action_prefix = nil, action_suffix = nil)
- ensure_slash_suffix(options, :action_prefix)
- ensure_slash_prefix(options, :action_suffix)
-
- prefix = options[:action_prefix] || action_prefix || ""
- suffix = options[:action] == "index" ? "" : (options[:action_suffix] || action_suffix || "")
- name = (options[:action] == "index" ? "" : options[:action]) || ""
-
- return prefix + name + suffix
- end
-
- def controller_name(options, controller_prefix)
- ensure_slash_suffix(options, :controller_prefix)
-
- controller_name = case options[:controller_prefix]
- when String: options[:controller_prefix]
- when false : ""
- when nil : controller_prefix || ""
- end
-
- controller_name << (options[:controller] + "/") if options[:controller]
- return controller_name
- end
-
- def path_params_in_list(options)
- options[:path_params].inject("") { |path, pair| path += "/#{pair.last}" }
- end
-
- def ensure_slash_suffix(options, key)
- options[key] = options[key] + "/" if options[key] && !options[key].empty? && options[key][-1..-1] != "/"
- end
-
- def ensure_slash_prefix(options, key)
- options[key] = "/" + options[key] if options[key] && !options[key].empty? && options[key][0..1] != "/"
- end
-
- def include_id_in_path_params(options)
- options[:path_params] = (options[:path_params] || {}).merge({"id" => options[:id]}) if options[:id]
- end
-
# Returns a query string with escaped keys and values from the passed hash. If the passed hash contains an "id" it'll
# be added as a path element instead of a regular parameter pair.
def build_query_string(hash)