@@ -43,7 +43,10 class News < ActiveRecord::Base | |||||
43 |
|
43 | |||
44 | # returns latest news for projects visible by user |
|
44 | # returns latest news for projects visible by user | |
45 | def self.latest(user = User.current, count = 5) |
|
45 | def self.latest(user = User.current, count = 5) | |
46 | find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") |
|
46 | find(:all, :limit => count, | |
|
47 | :conditions => Project.allowed_to_condition(user, :view_news), | |||
|
48 | :include => [ :author, :project ], | |||
|
49 | :order => "#{News.table_name}.created_on DESC") | |||
47 | end |
|
50 | end | |
48 |
|
51 | |||
49 | private |
|
52 | private |
General Comments 0
You need to be logged in to leave comments.
Login now