Rails newbie here. I'm trying to display a user's name when they post something. However, it keeps on showing the user_id (integer). I would like to display their actual name. I wired everything correctly. Here is the code. Thanks.
in post/index.html.erb.....@user.username will show an undefined method error.
<%= render 'layouts/header' %>
<!--posts table!-->
<div class="container">
<% @posts.each do |post| %>
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">
<%= post.title %>
<div class="pull-right">
<%= @user.username %> |
<%= time_ago_in_words(Time.now) %>
</div>
</h3>
</div>
<div class="panel-body">
<%= post.description %>
</div>
</div>
<% end %>