summaryrefslogtreecommitdiffstats
path: root/app/models/news.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-06 18:54:23 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-06 18:54:23 +0000
commit3a0a340bbde6ecfd9c5367c89b93c9b19fa1fd0e (patch)
tree8ba42d05547cb255452ab7bc4795abeeaf3e9b9c /app/models/news.rb
parent4d6c52a82b44a88a25eb0aee2fe7e01147cf68ef (diff)
downloadredmine-3a0a340bbde6ecfd9c5367c89b93c9b19fa1fd0e.tar.gz
redmine-3a0a340bbde6ecfd9c5367c89b93c9b19fa1fd0e.zip
Preload users and projects for latest news on welcome page.
git-svn-id: http://svn.redmine.org/redmine/trunk@13566 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/news.rb')
-rw-r--r--app/models/news.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/news.rb b/app/models/news.rb
index 65a22c66f..19a55bda4 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -71,7 +71,7 @@ class News < ActiveRecord::Base
# returns latest news for projects visible by user
def self.latest(user = User.current, count = 5)
- visible(user).joins([:author, :project]).order("#{News.table_name}.created_on DESC").limit(count).to_a
+ visible(user).preload(:author, :project).order("#{News.table_name}.created_on DESC").limit(count).to_a
end
private