Search code examples
ruby-on-railscssstyleshelpermethods

CSS style time_ago_in_words rails


I was wondering what would be the best solution for customising the rails helper: time_ago_in_words, so that I could do things like:

    <span class="one">4</span>
    <span class="two">hours</span>
    <span class="three">ago</span>

or what the layout looks like by default?

Thanks


Solution

  • I would just create a helper that splits the result of time_ago_in_words on spaces and returns the array of words. Then you can format them however you want.