Commit 4659d2722b4d782cdcd03a73acc1adea5b043c93
1 parent
01efec8c
Exists in
master
and in
23 other branches
ActionItem194: fixing the fix
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1708 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
app/models/article.rb
| ... | ... | @@ -32,8 +32,10 @@ class Article < ActiveRecord::Base |
| 32 | 32 | |
| 33 | 33 | # retrieves the latest +limit+ articles, sorted from the most recent to the |
| 34 | 34 | # oldest. |
| 35 | + # | |
| 36 | + # Only includes articles where advertise == true | |
| 35 | 37 | def self.recent(limit) |
| 36 | - options = { :limit => limit, :order => 'created_at desc, articles.id desc' } | |
| 38 | + options = { :limit => limit, :conditions => { :advertise => true }, :order => 'created_at desc, articles.id desc' } | |
| 37 | 39 | self.find(:all, options) |
| 38 | 40 | end |
| 39 | 41 | ... | ... |
app/models/recent_documents_block.rb
| ... | ... | @@ -10,8 +10,6 @@ class RecentDocumentsBlock < Block |
| 10 | 10 | def content |
| 11 | 11 | docs = self.limit.nil? ? owner.recent_documents : owner.recent_documents(self.limit) |
| 12 | 12 | |
| 13 | - docs.delete_if{|d| d.kind_of?(Article) and !d.advertise?} | |
| 14 | - | |
| 15 | 13 | block_title(_('Recent content')) + |
| 16 | 14 | content_tag('ul', docs.map {|item| content_tag('li', link_to(item.title, item.url))}.join("\n")) |
| 17 | 15 | ... | ... |