Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
My index file : Triing to apply simplify render in views (best practice)
<div class="article" data-ref="<%= article.id %>" data-text="<%= article.synopsis? %>" data-video="<%= article.video? %>">
<div class="img">
<%= image_tag(article.image.url(:panorama), :class => 'color') %>
</div>
</div>
<div id="contenu" class="contenu small">
<div class="grid inner-contenu">
<div class="c960">
<%= render 'article', :collection => @articles %>
</div>
</div>
</div>
RuntimeError in Articles#index
Showing /Users/stagiaire/Projects/vodmania/app/views/articles/_article.html.erb where line #1 raised:
Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
Extracted source (around line #1):
1: <div class="article" data-on="false" data-ref="<%= article.id %>" data-text="<%= article.has?(:synopsis) %>" data-video="<%= article.has_video? %>">
2: <div class="img">
3: <%= image_tag(article.image.url(:panorama), :class => 'color') %>
4: <%= image_tag(article.image.url(:panorama_black), :class => 'black') %>
Trace of template inclusion: app/views/articles/index.html.erb
@elentras
Copy link
Author

elentras commented Nov 14, 2012

In the index file, replacing render by :

<%= render @articles %>

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment