Hi guys, Is there a standard function/gem in rails that lets me format times in a facebookish way, like "x minutes ago"? Ideally one that works well together with a similar jquery library for live updates? Thanks Martin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I don''t know of a good gem solution (though it would be great if there were one because this is a problem that has been solved and re-solved too many times) but DHH did a blog post a few years back that explains exactly how to implement this in a relatively simple way. http://37signals.com/svn/posts/1557-javascript-makes-relative-times-compatible-with-caching On Tue, Jun 21, 2011 at 7:55 AM, Martin Wawrusch <martin-qs6+VQBngv1Wk0Htik3J/w@public.gmane.org>wrote:> Hi guys, > > Is there a standard function/gem in rails that lets me format times in a > facebookish way, like "x minutes ago"? Ideally one that works well together > with a similar jquery library for live updates? > > Thanks > Martin > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rails has inbuilt helpers for such kind of stuff. Check out the following docs, method like distance_of_time_in_words Rails 2.3 - http://api.rubyonrails.org/v2.3.10/classes/ActionView/Helpers/DateHelper.html Rails 3.0 - http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/iFPKuAI-AHUJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Awesome, thank you. Rails rocks! On Tue, Jun 21, 2011 at 1:17 AM, Chirag <chirag.singhal-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Rails has inbuilt helpers for such kind of stuff. > Check out the following docs, method like distance_of_time_in_words > Rails 2.3 - > http://api.rubyonrails.org/v2.3.10/classes/ActionView/Helpers/DateHelper.html > Rails 3.0 - > http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/iFPKuAI-AHUJ. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >- -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.