我知道这看起来微不足道,但可以说在 Ruby on Rails 中我有
document.expire_in = 7.days
如何打印到期消息的人类可读版本?
"Document will expire in #{document.expire_in}"
=> Document will expire in 7 days
也许可以与I18n.t
或I18n.l
唯一可行的方法是
7.days.inspect => "7 天"
这是唯一的方法吗??
我正在查看ActiveSupport::Duration并且没有看到答案
谢谢