Rails routing of a controller's functions query

Posted by Jty.tan on Stack Overflow See other posts from Stack Overflow or by Jty.tan
Published on 2010-05-13T07:40:28Z Indexed on 2010/05/13 7:44 UTC
Read the original article Hit count: 187

Filed under:
|

So I've got a Users controller, and it has (amongst others) a function called details.

The idea is that a user can go to localhost:3000/user/:user_id/details and be able to view the details of :user_id.

For example, I have a user called "tester". When I go to the uri: http://localhost:3000/users/tester/details I'd want the details function to be called up, to render the details view, and to display the information for the user tester.

But instead I get an error saying that

No action responded to tester. Actions: change_password, create, current_user, details, forgot_password, index, login_required, new, redirect_to_stored, show, and update_attributes

And I understand that to basically mean that if I wanted to access details, I should really be using

http://localhost:3000/users/details

Except that that isn't really working either... >.< That is instead bringing me to http://localhost:3000/users/details/registries (which is the default path that I'd stipulated for anybody trying to view users/:user_id, so again, that's working the way I wanted it to)

Point is: Can anybody help and tell me how I can go about getting users/:user_id/details to work the way I want it to and display the details of :user_id?

Thanks!

© Stack Overflow or respective owner

Related posts about rails

Related posts about routes