How do you do relative time in Rails?

前端 未结 11 1541
借酒劲吻你
借酒劲吻你 2020-12-02 03:43

I\'m writing a Rails application, but can\'t seem to find how to do relative time, i.e. if given a certain Time class, it can calculate \"30 seconds ago\" or \"2 days ago\"

11条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 04:42

    What about

    30.seconds.ago
    2.days.ago
    

    Or something else you were shooting for?

提交回复
热议问题