Added documentation for the :param option for resourceful routing

This commit is contained in:
Zack Perdue 2014-04-14 02:33:24 -04:00
parent 6c002ba092
commit cf786378e6

@ -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
-----------------------------