Skip to content

Instantly share code, notes, and snippets.

@iheartkode
Created February 20, 2015 21:02
Show Gist options
  • Save iheartkode/8747bbef8245a0896caa to your computer and use it in GitHub Desktop.
Save iheartkode/8747bbef8245a0896caa to your computer and use it in GitHub Desktop.
Showing C:/Sites/rails_studio/flix/app/views/movies/index.html.erb where line #16 raised:
undefined method `>' for nil:NilClass
<td><%= time_ago_in_words(movie.released_on) %> ago</td>
<h1><%= pluralize(@movies.size, 'Movie') %></h1>
<% @movies.each do |movie| %>
<article>
<header>
<h2><%= movie.title %></h2>
</header>
<p>
<%= truncate(movie.description, length: 40, separator: ' ') %>
</p>
<table>
<tr>
<th>Released:</th>
<td><%= movie.released_on %></td>
</tr>
<td><%= time_ago_in_words(movie.released_on) %> ago</td> # When I add time_ago_in_words() I get the error I post below
<th>Rating:</th>
<td><%= movie.rating %></td>
</tr>
<tr>
<th>Total Gross:</th>
<td><%= number_to_currency(movie.total_gross) %></td>
</tr>
</table>
</article>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment