diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2013-08-17 21:38:53 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2013-08-17 21:46:39 +0530 |
commit | ec8ef1e1055c4e1598da13f49d30261f07f4a9b4 (patch) | |
tree | d5450558358174f6963323061e25366246ff5801 /actionpack/lib/action_dispatch | |
parent | dba4c6fe539c24ec1beb106e34f37f3cd0632022 (diff) | |
download | rails-ec8ef1e1055c4e1598da13f49d30261f07f4a9b4.tar.gz rails-ec8ef1e1055c4e1598da13f49d30261f07f4a9b4.tar.bz2 rails-ec8ef1e1055c4e1598da13f49d30261f07f4a9b4.zip |
Revert "Merge branch 'master' of github.com:rails/docrails"
This reverts commit 70d6e16fbad75b89dd1798ed697e7732b8606fa3, reversing
changes made to ea4db3bc078fb3093ecdddffdf4f2f4ff3e1e8f9.
Seems to be a code merge done by mistake.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 943fc15026..0e5dc1fc6c 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -514,12 +514,11 @@ module ActionDispatch @recall = recall.dup @set = set - normalize_recall! normalize_options! normalize_controller_action_id! use_relative_controller! normalize_controller! - normalize_action! + handle_nil_action! end def controller @@ -538,11 +537,6 @@ module ActionDispatch end end - # Set 'index' as default action for recall - def normalize_recall! - @recall[:action] ||= 'index' - end - def normalize_options! # If an explicit :controller was given, always make :action explicit # too, so that action expiry works as expected for things like @@ -558,8 +552,8 @@ module ActionDispatch options[:controller] = options[:controller].to_s end - if options.key?(:action) - options[:action] = (options[:action] || 'index').to_s + if options[:action] + options[:action] = options[:action].to_s end end @@ -569,6 +563,8 @@ module ActionDispatch # :controller, :action or :id is not found, don't pull any # more keys from the recall. def normalize_controller_action_id! + @recall[:action] ||= 'index' if current_controller + use_recall_for(:controller) or return use_recall_for(:action) or return use_recall_for(:id) @@ -590,11 +586,13 @@ module ActionDispatch @options[:controller] = controller.sub(%r{^/}, '') if controller end - # Move 'index' action from options to recall - def normalize_action! - if @options[:action] == 'index' - @recall[:action] = @options.delete(:action) + # This handles the case of action: nil being explicitly passed. + # It is identical to action: "index" + def handle_nil_action! + if options.has_key?(:action) && options[:action].nil? + options[:action] = 'index' end + recall[:action] = options.delete(:action) if options[:action] == 'index' end # Generates a path from routes, returns [path, params]. |