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

distance_of_time_in_words_to_now ERROR

So while I'm trying to create a timestamp for a post, I keep getting an error when I start up the server.

My code is currently this:

<ul id="timeline">
<% tweets.each do |tweet| %>
<li<% if tweets.first == tweet %> class="first"<% end %>>
<%= image_tag tweet.user.gravatar_url %>
<div class="tweet_message_container">
<%= link_to tweet.user.username %>
<%= h tweet.message %>
<div class="time_ago">
<%= distance_of_time_in_words_to_now(tweet.created_at) %> ago
</div>
</div>
<div class ="clear"></div>
</li>
<% end %>
</ul>

But when I make the post, it comes out like this:

about {{count}} hours ago

or

{{count}} days ago

I'm getting very frustrated...Please help.

1 Answer

Try using this method:

time_ago_in_words(tweet.created_at)

No luck. It's still give me that {{count}} bullshxt. It writes out "minutes" and "hours", but the actual numbers turn into {{count}}.