移譲先がnilのdelegate

delegate + allow_nil: true で ok。

http://www.ckazu.info/blog/2013/12/14/delegate_allow_nil/

class User < ActiveRecord::Base
  belongs_to :profile
  delegate :job, to: :profile, allow_nil: true
end

time_ago_in_words

Railsで「~ 分前」とかそういうやつ。

time_ago_in_words(Time.now - 15.hours) # => about 15 hours
time_ago_in_words(Time.now)            # => less than a minute

ActionView::Helpers::DateHelper | RailsDoc(β)