I have a model 'User', it's a restful resource, and has the default methods like 'index, show, new, create' and others.
Now, I want to define a new action 'current_user', to show the information of current logged-in user, which is different from 'show'.
When I use:
link_to current_user.name, :controller=>'users', :action=>'current_user'
The generated url is http://localhost:3000/users/current_user
, and error message is:
Couldn't find User with ID=current_user
Shall I have to modify the routes.rb
? What should I do?
I have searched for some articles, and still have no idea.