How to show specific link to user that's signed in and on specific page in rails?
Posted
by
sevens
on Stack Overflow
See other posts from Stack Overflow
or by sevens
Published on 2012-11-18T16:47:28Z
Indexed on
2012/11/18
17:00 UTC
Read the original article
Hit count: 165
ruby-on-rails
|ruby-on-rails-3
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?
© Stack Overflow or respective owner