Hi, this blog is no longer maintained, my new blog is here

Ruby On Rails and a Conning Israeli entrepreneur

relative_time_helper plugin

most of us are using rails's built in time_ago_in_words, Rick Olsan wrote a much better plugin to extend that use and gives much better results.

  1. <%= relative_time(Time.now) %>  
  2. # today  
  3. <%= relative_time(1.day.ago) %>  
  4. # yesterday  
  5. <%= relative_time(1.day.from_now) %>  
  6. # tomorrow  
  7. <%= relative_time_span([Time.now, 5.days.from_now]) %>  
  8. # May 17th - 22nd  


To install it just snap it out of:

  1. script/plugin install http://ar-code.svn.engineyard.com/plugins/relative_time_helpers  

0 comments:


The Web Ask eizesus.com

Subscribe

    follow me on Twitter

    Twiters Around

    About Me

    My photo
    I am a web developer for more than 9 years, managed, cried, coded, designed and made money in this industry. now trying to do it again.

    Labels