I have a list of User objects in an index view. For each user, I am displaying a name with a link_to call for editing the user like so:
<% @users.each do |u| %>
<%= link_to u.name, edit_user_path(u) %><br/>
<% end %>
I want to use a different edit path based on the user's role attribute (e.g. employee, manager, etc). I have edit_employee_path, edit_manager_path, etc in my routes.
What's the best way dynamically determine the 2nd parameter to link_to? I can hack this up with a bunch of ugly if/else code but I want to do it the most idiomatic Rails way.