Skip to content

Instantly share code, notes, and snippets.

@malachaifrazier
Created September 25, 2012 15:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malachaifrazier/3782531 to your computer and use it in GitHub Desktop.
Save malachaifrazier/3782531 to your computer and use it in GitHub Desktop.
current_user.full_name shows method error because there is no user yet. Toss a conditional in there to fix all the things. if user_signed_in?
<!DOCTYPE html>
<html>
<head>
<title>Treebook</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a href="#" class="brand">Treebook</a>
<ul class="nav">
<li><%= link_to "All Statuses", statuses_path %></li>
</ul>
<ul class="nav pull-right">
<% if user_signed_in? %>
<li><%= link_to current_user.full_name, "#" %></li>
</ul>
<% end %>
</div>
</div>
<div class="container">
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= yield %>
</div>
</body>
</html>
@ConAntonakos
Copy link

Why is the user not signed in? If you sign up, are you not automatically signed in to the app immediately after signing up? Or perhaps, the issue is that you exit the rails server? This perplexed me a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment