Sha256: 8fe77eb5e08a7c728118b238d3bfd36d73e953c41dc8a8337109be5c4f703b77
Contents?: true
Size: 477 Bytes
Versions: 1
Compression:
Stored size: 477 Bytes
Contents
module Kblog module ArticlesHelper # renders :num: articles # if limit is given an greater than 0 # resulting articles will be truncated after # :limit: chars # def display_latest_articles(num,limit=0) truncate = limit > 0 ? limit : nil render(:partial => 'kblog/articles/article', :collection => limit_articles(num), :locals => { :limit => truncate} ) end def limit_articles(num=1) Article.order('created_at DESC').limit(num) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kblog-0.0.4 | app/helpers/kblog/articles_helper.rb |