diff options
author | Jose and Yehuda <wycats@gmail.com> | 2012-04-25 16:06:20 -0500 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2012-04-25 16:07:17 -0500 |
commit | 6acebb38bc0637bc05c19d87f8767f16ce79189b (patch) | |
tree | e37fa39f516e16c1d36e3b5202e9231c56aa4305 /guides | |
parent | 3c100cfe8ed5a875b0bbdc8fa4e8f2b0cbf78676 (diff) | |
download | rails-6acebb38bc0637bc05c19d87f8767f16ce79189b.tar.gz rails-6acebb38bc0637bc05c19d87f8767f16ce79189b.tar.bz2 rails-6acebb38bc0637bc05c19d87f8767f16ce79189b.zip |
Allow loading external route files from the router
This feature enables the ability to load an
external routes file from the router via:
draw :filename
External routes files go in +config/routes+. This
feature works in both engines and applications.
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/routing.textile | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/guides/source/routing.textile b/guides/source/routing.textile index 5e1cc042dc..836e0cdd70 100644 --- a/guides/source/routing.textile +++ b/guides/source/routing.textile @@ -829,6 +829,24 @@ end This will create routing helpers such as +magazine_periodical_ads_url+ and +edit_magazine_periodical_ad_path+. +h3. Breaking Up a Large Route File + +If you have a large route file that you would like to break up into multiple files, you can use the +#draw+ method in your router: + +<ruby> +draw :admin +</ruby> + +Then, create a file called +config/routes/admin.rb+. Name the file the same as the symbol passed to the +draw+ method). You can then use the normal routing DSL inside that file: + +<ruby> +# in config/routes/admin.rb + +namespace :admin do + resources :posts +end +</ruby> + h3. Inspecting and Testing Routes Rails offers facilities for inspecting and testing your routes. |