Sha256: 1bd5039e817e743d7947f1b90318bc9179c76f87c21d0029e19d1cc96ae721fe
Contents?: true
Size: 575 Bytes
Versions: 10
Compression:
Stored size: 575 Bytes
Contents
module Blog module Models class Entry < Default one_to_many :comments, :class => Blog::Models::Comment, :key => :entry_id, :order => :updated_on before_save do set_with_params(:updated_on => Time.now) if columns.include? :updated_on end def date updated_on.strftime('%b %d, %Y') end def comment_number n = comments.size case n when 0 "No Comments" when 1 "1 Comment" else "#{n} Comments" end end end end end
Version data entries
10 entries across 10 versions & 4 rubygems