aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorZachary Scott <e@zzak.io>2014-05-29 00:16:41 -0700
committerZachary Scott <e@zzak.io>2014-05-29 00:18:52 -0700
commitec7fee498291b90983cf130a81ad1647b10f1c8b (patch)
treec19c2167552632a17c34d472bdd1fc8682142093 /guides
parent03ee41948d53457f8147fce87acee1dcbf8abb8f (diff)
parentcf786378e61760c3f7911f83ea31654986ea85f8 (diff)
downloadrails-ec7fee498291b90983cf130a81ad1647b10f1c8b.tar.gz
rails-ec7fee498291b90983cf130a81ad1647b10f1c8b.tar.bz2
rails-ec7fee498291b90983cf130a81ad1647b10f1c8b.zip
Merge branch 'master' of github.com:zackperdue/rails into zackperdue-master
Diffstat (limited to 'guides')
-rw-r--r--guides/source/routing.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/guides/source/routing.md b/guides/source/routing.md
index 0ff13cb07d..574a1f9c68 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -1044,6 +1044,25 @@ end
This will create routing helpers such as `magazine_periodical_ads_url` and `edit_magazine_periodical_ad_path`.
+### Overriding Named Route Parameters
+
+The `:param` option overrides the default resource identifier `:id` allowing you to use the specified name in your controller action to find the specific resource in the database.
+
+```ruby
+resources :videos, param: :identifier
+```
+
+```
+ videos GET /videos(.:format) videos#index
+ POST /videos(.:format) videos#create
+ new_videos GET /videos/new(.:format) videos#new
+edit_videos GET /videos/:identifier/edit(.:format) videos#edit
+```
+
+```ruby
+Video.find_by(identifier: params[:identifier])
+```
+
Inspecting and Testing Routes
-----------------------------