beginner alert! I have this IF statement in my user#show view. I checked if any post for user_id:7 in rails console, it returns the result "nil", but when I looked at http://localhost:3000/users/7, I can't see the "You don't have any post yet. Keep posting!" comment.
<% @posts.each do |post| %>
<% if @posts != nil %>
<%= link_to "#{post.title}", post_path(post) %>
<% else %>
<p> You don't have any post yet. Keep posting! </p>
<% end %>
<% end %>
Could anyone help me? thanks!
Aucun commentaire:
Enregistrer un commentaire