1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

root route should go at the *top* of the routes file, because it is the most popular route and should be matched first

This commit is contained in:
Ryan Bigg 2010-12-09 20:21:08 +10:00
parent d2f98e5b55
commit fe0e3880e8

View file

@ -247,7 +247,9 @@ module ActionDispatch
#
# root :to => 'pages#main'
#
# You should put the root route at the end of <tt>config/routes.rb</tt>.
# You should put the root route at the top of <tt>config/routes.rb</tt>,
# because this means it will be matched first. As this is the most popular route
# of most Rails applications, this is beneficial.
def root(options = {})
match '/', options.reverse_merge(:as => :root)
end