Topic: alterbative nav

I have a link in my navigation that i would like to change based if they have a profile or not.

When you first log in i want to show the link to create to profile and every other time i want to show the link of update_profile

i have a session of the user that is logged in

"warden.user.user.key"=>["User", [2], "$2a$10$jGRBkj3fGrY4zV0cwQWUx."]

but i guess that my question is

<% if profile.user_id(2) == nil %> 
 <%= link_to "Master Card", new_profile_path %>
<% else %>
<%= link_to "Master Card", profile_path %>
<% end %>

Re: alterbative nav

How about:

User Model has_one profile
Profile Model belongs_to user

current_user ( or whatever you wanna call it ) should be a helper of your session model to get the current user.

<% if current_user.profile.exist? %>
  <%= linkt_to "Master Card", profile_path %>
<% else %>
  <%= link_to "Master Card", new_profile_path %>
<% end %>