diff options
author | Ryan Bigg <radarlistener@gmail.com> | 2010-12-09 20:21:08 +1000 |
---|---|---|
committer | Ryan Bigg <radarlistener@gmail.com> | 2010-12-09 20:21:08 +1000 |
commit | fe0e3880e8ce8311882f3856b689c2f79a13ced4 (patch) | |
tree | 4a9b1e61376b26816c20772ebf9b975ffb4bfa96 | |
parent | d2f98e5b556815f7b9cf84d3702d93a0bfb7d433 (diff) | |
download | rails-fe0e3880e8ce8311882f3856b689c2f79a13ced4.tar.gz rails-fe0e3880e8ce8311882f3856b689c2f79a13ced4.tar.bz2 rails-fe0e3880e8ce8311882f3856b689c2f79a13ced4.zip |
root route should go at the *top* of the routes file, because it is the most popular route and should be matched first
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 086366c740..cf95f6fa53 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -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 |