Nathaniel Rand Nathaniel Rand - 1 month ago 9
Ruby Question

Ruby / Rails 4 - SyntaxError in UsersController#show

I need fresh eyes to guide me through this syntax error.

Error: SyntaxError in UsersController#show

Extracted source (around line #164):

162 <div class="panel panel-default">
163 <h3>STREAM</h3>
164 <%= if @user.microposts.any? %>
165 <h4><%= @user.microposts.count %> Posts</h4>
166 <ol class="microposts">
167 <%= render @microposts %>





Error: SyntaxError in UsersController#show (Screenshot)

SyntaxError in UsersController#show




Error: View

<!--MICROPOSTS FEED-->
<div class="panel panel-default">
<h3>STREAM</h3>
<%= if @user.microposts.any? %>
<h4><%= @user.microposts.count %> Posts</h4>
<ol class="microposts">
<%= render @microposts %>
</ol>
<%= will_paginate @microposts %>
<% end %>
</div>

Answer
<%= if @user.microposts.any? %>

should be

<% if @user.microposts.any? %>

nothing to display :P