@@ -52,9 +52,7 class News < ActiveRecord::Base | |||
|
52 | 52 | |
|
53 | 53 | # returns latest news for projects visible by user |
|
54 | 54 | def self.latest(user = User.current, count = 5) |
|
55 | includes([:author, :project]).where( | |
|
56 | Project.allowed_to_condition(user, :view_news) | |
|
57 | ).order("#{News.table_name}.created_on DESC").limit(count).all | |
|
55 | visible(user).includes([:author, :project]).order("#{News.table_name}.created_on DESC").limit(count).all | |
|
58 | 56 | end |
|
59 | 57 | |
|
60 | 58 | private |
General Comments 0
You need to be logged in to leave comments.
Login now