Reputation: 13
I currently have allowed admins to delete a user by having
link_to("Delete", admin_path(resource), :confirm => "Do you want to delete this item?", :method => :delete)
How do I add the option for view, where I want someone to view that item?
Upvotes: 0
Views: 46
Reputation: 2332
Rails applications typically respond to various actions based on HTTP verb, which routes to a method for that Controller. The comments point out the correct code to link to the default show method for the Controller:
link_to("View", resource_path(resource))
However, you have to actually have a method written to retrieve and display the contents of the resource, including a template to display the fields, etc.
Upvotes: 1