diff options
author | Brian Cardarella <bcardarella@gmail.com> | 2012-03-03 22:17:34 -0500 |
---|---|---|
committer | Brian Cardarella <bcardarella@gmail.com> | 2012-03-03 22:25:05 -0500 |
commit | 2ee4dd856d47113625589bc5410b5a6669ea02d5 (patch) | |
tree | d573e5a7cd27390a6097b3eb0d8582878bdd8d59 /actionpack/lib/action_dispatch/routing | |
parent | b4ac72c63890e139745f32a5c642ead548e038ba (diff) | |
download | rails-2ee4dd856d47113625589bc5410b5a6669ea02d5.tar.gz rails-2ee4dd856d47113625589bc5410b5a6669ea02d5.tar.bz2 rails-2ee4dd856d47113625589bc5410b5a6669ea02d5.zip |
Route root helper shortcut
Allow the root route helper to accept just a string
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 5 |
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 |