app/views/index/index.html.erb
<% if flash[:notice] %>
<div class="notice alert alert-success"><%= flash[:notice] %></div>
<% end %>
<% if @posts != nil %>
<% @posts.each do |p| %>
<%= render 'post', {p: p} %>
<% end %>
<% else %>
<div class="alert alert-danger">
<strong>Error!</strong><br />
There are currently no posts available.
</div>
<% end %>
<%= paginate @posts %>