Created
September 30, 2008 13:54
-
-
Save Mikr0Tik/13820 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| people_controller.rb: | |
| class PeopleController < ApplicationController | |
| end | |
| the PeopleController shall handle all people (asia, europe, america, africa, australia): | |
| but i'd like to have routes like: | |
| - /asia/12 -> PeopleController.show params=>{:id=>12, :continent=>'asia'} :get | |
| - /america -> PeopleController.index params=>{:continent=>'america'} :get | |
| - /africa/3/edit -> PeopleController.edit params=>{:id=>3, :continent=>'africa'} :get | |
| - /europe/20 -> PeopleController.update params=>{:id=>20, :continent=>'europe'} :put | |
| - /australia -> PeopleController.create params=>{:continent=>'australia'} :post | |
| the question is how to create such routes? | |
| it would be nice to get helper: | |
| people_path(:continent=>'asia') => /asia => People.index with params {:continent=>'asia'} | |
| people_path(:continent=>'europe') => /europe => People.index with params {:continent=>'europe'} | |
| people_path(@person, :continent=>'asia') => /asia/12 => People.show with params {:continent=>'asia', :id=>12} | |
| and furthermore i need the nested routes like map.resource :people, :has_many=>:cars |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment