From a3c25c18d7cce486dec8f050e1ddec874ba61ca8 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 5 May 2012 09:54:50 +0000 Subject: [PATCH] Code cleanup, reuse the visible scope. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9633 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/news.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/models/news.rb b/app/models/news.rb index 11be6d130..a09f010aa 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -52,9 +52,7 @@ class News < ActiveRecord::Base # returns latest news for projects visible by user def self.latest(user = User.current, count = 5) - includes([:author, :project]).where( - Project.allowed_to_condition(user, :view_news) - ).order("#{News.table_name}.created_on DESC").limit(count).all + visible(user).includes([:author, :project]).order("#{News.table_name}.created_on DESC").limit(count).all end private -- 2.39.5