diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2005-07-14 09:09:39 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2005-07-14 09:09:39 +0000 |
commit | 6ed16ff60290620c87772670d312585f2431d03f (patch) | |
tree | 7cef602051d2cb104deedf95e6b1d105e5042caa /actionpack/lib/action_controller/routing.rb | |
parent | 16595c93b294f3fa852993dc3b2ba4b9df253147 (diff) | |
download | rails-6ed16ff60290620c87772670d312585f2431d03f.tar.gz rails-6ed16ff60290620c87772670d312585f2431d03f.tar.bz2 rails-6ed16ff60290620c87772670d312585f2431d03f.zip |
Provide correct defaults for Named Routes which do not specify :action
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1833 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/routing.rb')
-rw-r--r-- | actionpack/lib/action_controller/routing.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index f7d3fe3369..fd9904a20e 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -288,9 +288,16 @@ module ActionController generator.before, generator.current, generator.after = [], components.first, (components[1..-1] || []) if known.empty? then generator.go - else generator.if(generator.check_conditions(known)) {|gp| gp.go } + else + # Alter the conditions to allow :action => 'index' to also catch :action => nil + altered_known = known.collect do |k, v| + if k == :action && v== 'index' then [k, [nil, 'index']] + else [k, v] + end + end + generator.if(generator.check_conditions(altered_known)) {|gp| gp.go } end - + generator end @@ -363,7 +370,7 @@ module ActionController def add_default_requirements component_keys = components.collect {|c| c.key} - known[:action] ||= [nil, 'index'] unless component_keys.include? :action + known[:action] ||= 'index' unless component_keys.include? :action end end |