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

Ruby

In the updating the Index Page of the Ruby on rails tutorial edit, and delete not showing.

I followed all of the steps precisely, however I cannot get the application to show the edit, and delete links under the posts. I have made sure my code is for exactly the same, however I can't figure it out.

This is the code i got in the index.html.erb file so far:

<div class="page-header">
<h1>All of the Statuses</h1>
</div>

<% @statuses.each do |status| %>
<div class="status">
  <strong><%= status.name %></strong>
  <p><%= status.content %>
    <div class="meta">
      <%= link_to "Show", status %>
      <span class="all">
        <% link_to "Edit", edit_status_path(status) %> |
         <% link_to "Delete", status, method: :delete, data: { confirm: "Are you sure you want to delete this status?"} %> 
      </span>
    </div>
<% end %>

2 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Try changing your "Edit" and "Delete" links to say <%= link_to "Edit" ... rather than with the "<%" syntax. By putting an equals sign after the percent sign, that will display the output in an ERB template. The other form only runs the code inside.

Thanks a lot! I got it to work.