Timestamping posts “Twitter style”

I’m building the “Getting Started” app again and new things pop into my head. This time I wanted timestamps.

Posted <%= time_ago_in_words(post.created_at) %> ago

I created a “Posts” model and post_controller. This code was pasted in the controller which outputs e.g. “Posted 5 minutes ago” similar to how Twitter timestamps posts.

Leave a Reply