diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-05-05 09:54:50 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-05-05 09:54:50 +0000 |
commit | a3c25c18d7cce486dec8f050e1ddec874ba61ca8 (patch) | |
tree | 9a56991b9ce37464f618cfcbcad3af9d4cb40a4b /app/models/news.rb | |
parent | 61a1fa1b6e29ecaec656e3e601ae0d298185cb68 (diff) | |
download | redmine-a3c25c18d7cce486dec8f050e1ddec874ba61ca8.tar.gz redmine-a3c25c18d7cce486dec8f050e1ddec874ba61ca8.zip |
Code cleanup, reuse the visible scope.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9633 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/news.rb')
-rw-r--r-- | app/models/news.rb | 4 |
1 files changed, 1 insertions, 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 |