This is the code for my side bar. When a user clicks on one of the links, the js.erb file is called, but I don't know how to make the js.erb file be able to differentiate which link the user clicked on. My idea is to use an id, so basically pass the instance variable to the js.erb file. This is how I think it might be done, but I'm not sure at all.
<li>
<%= link_to 'User Details', '/dashboard', :id => 'User Details', remote: true %>
</li>
<li>
<%= link_to 'Projects', '/dashboard', :id => 'Projects', remote: true %>
</li>
There's the js.erb file that's run with this code:
<% if :id == 'User Details' %>
$('#ajax').html("<%= escape_javascript(render :partial => 'users/edit', :locals => { :user => @user } ) %>");
<% elsif :id == 'Projects' %>
$('#ajax').html("<%= escape_javascript(render :partial => 'projects/index', :locals => { :projects => @projects } ) %>");
<% end %>
What am I doing wrong or how should I pass some sort of flag or id to the js.erb file so that I can show the correct information?