availables methods/actions available with the @posts
katawura opened this issue · comments
kelvin atawura commented
l am trying to pull the first post using below:
<%= @posts.first do |post|%>
<div class="large-6">
<div class="article-out">
<div class="figure"><img src="<%= asset_path( 'banner-med-07.jpg' ) %>" alt="Banner" /></div>
<div class="aside">
<h3><a href="#"><% post.title %></a></h3>
<p>Edited by <% post.user.name %></p>
<% link_to t("See Editorial"), post.full_url, class: "see-link" %>
</div>
<div class="date-out">
<div class="date-txt"><% post.published_at.to_date.day %></div>
<div class="month-txt"><% post.published_at.to_date.strftime("%b") %>/<% post.published_at.to_date.strftime("%y") %></div>
</div>
</div>
</div>
<% end %>
But doesn't seem to pass please can you advise on the methods availble please?
Michael Sevestre commented
<%= @posts.first do |post|%>
this looks weird to me
propably should be sthg like <%post = @posts.first%>
or sthg similar?
Michael Sevestre commented
What do you mean with But doesn't seem to pass
?
kelvin atawura commented
It was not showing anything in my view. l stopped looping it and it worked for me. cheers