How to show specific link to user that's signed in and on specific page in rails?
- by sevens
I have the following code for part of my navigation:
<% if user_signed_in? %>
<li><%= link_to 'Edit Profile', edit_profile_path(current_user.profile) %></li>
<li><%= link_to 'Edit Account', edit_user_registration_path %></li>
<% elsif user_signed_in? and params[:controller] == 'profiles#edit' %>
<li><%= link_to 'View Profile', profile_path(current_user.profile) %></li>
<li><%= link_to 'Edit Account', edit_user_registration_path %></li>
<% else %>
<li><%= link_to 'Sign up', new_user_registration_path %></li>
<% end %>
I want different links to show depending on where the "user_signed_in" is. However, my <% elsif user_signed_in? and params[:controller] == 'profiles#edit' %> doesn't seem to be working.
What am I doing wrong?