summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/news.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/models/news.rb b/app/models/news.rb
index bf1cc4f80..11be6d130 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -52,10 +52,9 @@ class News < ActiveRecord::Base
# returns latest news for projects visible by user
def self.latest(user = User.current, count = 5)
- find(:all, :limit => count,
- :conditions => Project.allowed_to_condition(user, :view_news),
- :include => [ :author, :project ],
- :order => "#{News.table_name}.created_on DESC")
+ includes([:author, :project]).where(
+ Project.allowed_to_condition(user, :view_news)
+ ).order("#{News.table_name}.created_on DESC").limit(count).all
end
private