mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-22 16:31:12 +00:00
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
This commit is contained in:
parent
4d6c52a82b
commit
3a0a340bbd
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user