Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Dan Barrett
148 PointsSimple Ruby Problem: creating the statuses loop
Hello everyone,
I'm in the Simply Ruby App course, on the "updating the index page" chapter - and I think I may be going mad.
I've been following along and doing well, but my application is no longer passing statuses - it gives me blanks instead.
Here's my code:
<div class="page-header">
<h1> All Statuses</h1>
</div>
<% @statuses.each do |status| %>
<div class="status">
<strong><% status.name %></strong>
<p><% status.content %></p>
<div class="meta">
<% link_to "Show", status %>
</div>
<span class ="admin">
<% link_to "Edit", edit_status_path(status) %> |
<% link_to "Delete", status, method: :delete, data: { confirm: :"Are you sure, man?"} %>
</span> </div> <% end %>
I could swear that is exactly what I'm supposed to have, but what I get is My Statuses page, with the same number of dividing links ( "|") as I should have statuses, but no text whatsoever.
Am I Crazy? Am I missing something simple?
Dan
2 Answers
Rodrigo Medeiros
Courses Plus Student 2,952 PointsHI Dan,
I think the problem is a "code typo". You wrote:
<strong><% status.name %></strong>
<p><% status.content %></p>
, but you should've written:
<strong><%= status.name %></strong>
<p><%= status.content %></p>
The same with the 'link_to' tags:
<% link_to "Edit", edit_status_path(status) %>
, where it should be:
<%= link_to "Edit", edit_status_path(status) %>
I think it should work.
Dan Barrett
148 PointsOH MY GOD
how is it that you can stare at things like this forever and just never see the issue? Thank you so much!
:-D
Rodrigo Medeiros
Courses Plus Student 2,952 PointsYou're welcome!