What is the best way to route a new method so that it can be called like so:
method_users_path
Users is a model, method is the new method i created which i want to link to.
Thanks, Muki
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.
If you are doing with rails 3 you can have something like this in your routes.
this will create you method_users_path. Also you can use post/get instead of match if you want to be request type specific. See more about rails routing here
Update
When you say
:collection, your route not will be object specific.Collection action is for example the index, you dont have to pass any id for index.
For example
users_pathAnother is the
:member, the member is object specific, so you have to pass an object id as a parameter, for exampleedit_user_path(@user)and you are passing user as a parameter.