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

Sean Perryman
Sean Perryman
13,810 Points

Designing URLs: Extra Credit

So, I thought "What the hell?" and started working with this extra credit piece. Seemed easy enough; figured out how to get everything to show up in the routes as updates instead of statuses. Got all my links and everything updated just fine. My problem comes in on the loop;

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

I keep getting an issue with switching 'status' inside the loop to 'update' or 'updates'. I realize that it is creating the instance variable 'status' (I think that is the correct term), but even changing those over to update or updates doesn't seem to work.

1 Answer

What exactly is your error? If you are changing things in the routes file, that could effect the edit_status_path. In the terminal, run rake routes to see the available routes.