提交 7868cf8a 编写于 作者: A Aaron Patterson

use regular ruby rather than clever ruby

上级 ba43b9bf
...@@ -105,13 +105,13 @@ def normalize_path(path) ...@@ -105,13 +105,13 @@ def normalize_path(path)
# controllers with default routes like :controller/:action/:id(.:format), e.g: # controllers with default routes like :controller/:action/:id(.:format), e.g:
# GET /admin/products/show/1 # GET /admin/products/show/1
# => { :controller => 'admin/products', :action => 'show', :id => '1' } # => { :controller => 'admin/products', :action => 'show', :id => '1' }
@options.reverse_merge!(:controller => /.+?/) @options[:controller] ||= /.+?/
end end
# Add a constraint for wildcard route to make it non-greedy and match the # Add a constraint for wildcard route to make it non-greedy and match the
# optional format part of the route by default # optional format part of the route by default
if path.match(WILDCARD_PATH) && @options[:format] != false if path.match(WILDCARD_PATH) && @options[:format] != false
@options.reverse_merge!(:"#{$1}" => /.+?/) @options[$1.to_sym] ||= /.+?/
end end
if @options[:format] == false if @options[:format] == false
...@@ -264,7 +264,7 @@ module Base ...@@ -264,7 +264,7 @@ module Base
# because this means it will be matched first. As this is the most popular route # because this means it will be matched first. As this is the most popular route
# of most Rails applications, this is beneficial. # of most Rails applications, this is beneficial.
def root(options = {}) def root(options = {})
match '/', options.reverse_merge(:as => :root) match '/', { :as => :root }.merge(options)
end end
# Matches a url pattern to one or more routes. Any symbols in a pattern # Matches a url pattern to one or more routes. Any symbols in a pattern
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册