Permalink
Browse files

root route should go at the *top* of the routes file, because it is t…

…he most popular route and should be matched first
  • Loading branch information...
1 parent d3d23e2 commit d575229ea43aac896d0e5ba11e1e3ac5ed1a2191 @radar radar committed with fxn Dec 9, 2010
Showing with 3 additions and 1 deletion.
  1. +3 −1 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -246,7 +246,9 @@ def initialize(set) #:nodoc:
#
# 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

0 comments on commit d575229

Please sign in to comment.