Files
growstuff/app/views/posts/_summary.html.haml
Cjay Billones bb88041fef [Refactoring] Replace .count and .length with .size for collections
Improved program efficiency (in querying in particular) by replacing .count and .length with .size for collections.

Fix error in refactoring

Reverted some .size into .count
2015-06-25 12:09:03 +08:00

22 lines
625 B
Plaintext

- howmany ||= 100
- if posts.size > 0
%table.table.table-striped
%tr
%th Subject
%th.hidden-xs Posted by
%th Most recent activity
%th.hidden-xs Comments
- posts.recently_active[0..howmany-1].each do |post|
- cache post do
%tr
%td
= link_to truncate(strip_tags(post.subject), :length => 40, :separator => ' '), post
%td.hidden-xs
=link_to post.author, post.author
%td
= distance_of_time_in_words(post.recent_activity, Time.zone.now)
ago
%td.hidden-xs
= post.comments.size.to_s