Created
November 14, 2012 09:18
-
-
Save elentras/4071146 to your computer and use it in GitHub Desktop.
My index file : Triing to apply simplify render in views (best practice)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="contenu" class="contenu small"> | |
<div class="grid inner-contenu"> | |
<div class="c960"> | |
<%= render 'article', :collection => @articles %> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the index file, replacing render by :
<%= render @articles %>