From f7cdd26b34912d7d8a031d6b44c19cc259d022e9 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 24 Feb 2005 00:04:48 +0000 Subject: Removed unused methods in url_rewriting.rb #701 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@777 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/url_rewriter.rb | 38 ++---------------------- 1 file changed, 2 insertions(+), 36 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index 7fdf95a79d..6c51ef3f3e 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -2,7 +2,7 @@ module ActionController # Rewrites URLs for Base.redirect_to and Base.url_for in the controller. class UrlRewriter #:nodoc: - RESERVED_OPTIONS = [:anchor, :params, :path_params, :only_path, :host, :protocol] + RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol] def initialize(request, parameters) @request, @parameters = request, parameters @rewritten_path = @request.path ? @request.path.dup : "" @@ -19,11 +19,6 @@ module ActionController alias_method :to_s, :to_str private - def validate_options(valid_option_keys, supplied_option_keys) - unknown_option_keys = supplied_option_keys - valid_option_keys - raise(ActionController::ActionControllerError, "Unknown options: #{unknown_option_keys}") unless unknown_option_keys.empty? - end - def rewrite_url(path, options) rewritten_url = "" rewritten_url << (options[:protocol] || @request.protocol) unless options[:only_path] @@ -31,7 +26,6 @@ module ActionController rewritten_url << options[:application_prefix] if options[:application_prefix] rewritten_url << path - rewritten_url << build_query_string(new_parameters(options)) if options[:params] || options[:overwrite_params] rewritten_url << "##{options[:anchor]}" if options[:anchor] return rewritten_url @@ -39,6 +33,7 @@ module ActionController def rewrite_path(options) options = options.symbolize_keys + options.update((options[:params]).symbolize_keys) if options[:params] RESERVED_OPTIONS.each {|k| options.delete k} path, extras = Routing::Routes.generate(options, @request) @@ -49,25 +44,6 @@ module ActionController return path end - def rewrite_path_params(path, options) - index_action = options[:action] == 'index' || options[:action].nil? && @action == 'index' - id_only = options[:path_params].size == 1 && options[:path_params]['id'] - - if index_action && id_only - path += '/' unless path[-1..-1] == '/' - path += "index/#{options[:path_params]['id']}" - path - else - options[:path_params].inject(path) do |path, pair| - if options[:action].nil? && @request.parameters[pair.first] - path.sub(/\b#{@request.parameters[pair.first]}\b/, pair.last.to_s) - else - path += "/#{pair.last}" - end - end - end - end - def action_name(options, action_prefix = nil, action_suffix = nil) ensure_slash_suffix(options, :action_prefix) ensure_slash_prefix(options, :action_suffix) @@ -108,16 +84,6 @@ module ActionController options[:path_params] = (options[:path_params] || {}).merge({"id" => options[:id]}) if options[:id] end - def new_parameters(options) - parameters = options[:params] || existing_parameters - parameters.update(options[:overwrite_params]) if options[:overwrite_params] - parameters.reject { |key,value| value.nil? } - end - - def existing_parameters - @request.parameters.reject { |key, value| %w( id action controller).include?(key) } - 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) -- cgit v1.2.3