aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2012-03-04 08:34:41 -0800
committerPiotr Sarnacki <drogus@gmail.com>2012-03-04 08:34:41 -0800
commite09fd970183fe1d4f65f3bc7a68de4041042c0fd (patch)
tree33e6722db24d973339e8ac3bd39ee63477bfe9a8 /actionpack/lib
parent44e79673ae8d9ef63a2630fb97711c4d2e2126ee (diff)
parent2ee4dd856d47113625589bc5410b5a6669ea02d5 (diff)
downloadrails-e09fd970183fe1d4f65f3bc7a68de4041042c0fd.tar.gz
rails-e09fd970183fe1d4f65f3bc7a68de4041042c0fd.tar.bz2
rails-e09fd970183fe1d4f65f3bc7a68de4041042c0fd.zip
Merge pull request #5266 from bcardarella/root_with_string_options
Route root helper shortcut
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 80fcdab643..cd215034dc 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -254,10 +254,15 @@ module ActionDispatch
#
# For options, see +match+, as +root+ uses it internally.
#
+ # You can also pass a string which will expand
+ #
+ # root 'pages#main'
+ #
# 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 = {})
+ options = { :to => options } if options.is_a?(String)
match '/', { :as => :root }.merge(options)
end