Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有以下情况:
LogEntry.format_time(3600).should eql("01:00:00")
这该怎么做?
在您的 LogEntry 模型中添加以下内容。
class LogEntry < ActiveRecord::Base #your properties and attributes def self.format_time(seconds) Time.at(seconds).utc.strftime("%H:%M:%S") end end