Assign default options, such as ‘index’ as a default for :action. This method must be run after user supplied requirements and defaults have been applied to the segments.
Source Code
# File action_controller/routing/builder.rb, line 123 def assign_default_route_options(segments) segments.each do |segment| next unless segment.is_a? DynamicSegment case segment.key when :action if segment.regexp.nil? || segment.regexp.match('index').to_s == 'index' segment.default ||= 'index' segment.is_optional = true end when :id if segment.default.nil? && segment.regexp.nil? || segment.regexp =~ '' segment.is_optional = true end end end end
<code/>and<pre/>for code samples.