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


Treebook not displaying "time ago"

I can't get treebook to display the timestamp in any form. What am I doing wrong?

<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 %></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) %> | <%= link_to "Delete", status, method: :delete, data: { confirm: "Are you sure you want to delete this?"} %> </span> </div> </div> <% end %>

Bertan Ulusoy
Bertan Ulusoy
18,047 Points


You forgot equal sign before link_to.

it should look like this -> <%= link_to time_ago_in_words(status.created_at)...

It does have the link_to. The way the copy-paste worked it put everything in a big heaping paragraph but it is there.

2 Answers

It looks like your link_to is currently this for displaying time ago:

<% link_to time_ago_in_words(status.created_at) + " ago", status %>

The reason it's not showing up is because you left out an = sign. Here is what it should look like:

<%= link_to time_ago_in_words(status.created_at) + " ago", status %>

That should hopefully do the trick!

Thanks both of you. I had not read the previous response carefully enough. Coming at it fresh it is all quite clear. Thanks a bunch.

You're welcome. Glad to help! :)