Created
October 2, 2012 19:06
-
-
Save samiron/3822574 to your computer and use it in GitHub Desktop.
Rails 2.3.2 Routing Example
This file contains 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
#config/routes.rb | |
map.route_a 'my_controller', :controller => "Users", :action => "a" | |
map.route_b 'my_controller/uid/:uid', :controller => "Users", :action => "b" | |
#Generated Links | |
route_a_url() ---> http://localhost:3000/my_controller | |
route_b_url(:uid => 10) ---> http://localhost:3000/my_controller/uid/10 | |
#Requesting to the above url redirects two different actions | |
#Output of rake routes | |
route_a /my_controller {:controller=>"Users", :action=>"a"} | |
route_b /my_controller/uid/:uid {:controller=>"Users", :action=>"b"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment