Small routing question:
I want
myapp.com/my_controller-> lead to controller Amyapp.com/my_controller?uid=123-> lead to controller B
any ideas how to change the routs file (in rails 2.3)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Rails 2.3.1:
You should get
route_a_urlandroute_b_url(:uid => uid)helper method to generate urls. Its not exactly query parameters but its usinguidand a value both.Rails 3.2.1:
And the helper functions
route_a_urlandroute_b_url(:uid=>10)were readily available.Explnation:
In your view, use the helper functions to generate urls
Helper Function:
route_a_url()Generated URL:
http://localhost:3000/my_controllerMap to:
Controller A, Action aHelper Function:
route_b_url(:uid => 10))Generated URL:
http://localhost:3000/my_controller/uid/10Map to:
Controller B, Action b