aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/routing.rb13
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