Mercurial > hg > soundsoftware-site
comparison app/models/news.rb @ 377:0802551af0a5 live
Merge from branch "feature_126"
author | Chris Cannam |
---|---|
date | Fri, 01 Apr 2011 17:24:48 +0100 |
parents | dcfde3922ec2 |
children | 350acce374a2 |
comparison
equal
deleted
inserted
replaced
373:c2230be27b7e | 377:0802551af0a5 |
---|---|
35 | 35 |
36 # returns latest news for projects visible by user | 36 # returns latest news for projects visible by user |
37 def self.latest(user = User.current, count = 5) | 37 def self.latest(user = User.current, count = 5) |
38 find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") | 38 find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") |
39 end | 39 end |
40 | |
41 # returns latest news for a specific project | |
42 def self.latest_for(project, count = 5) | |
43 find(:all, :limit => count, :conditions => [ "#{News.table_name}.project_id = #{project.id}", Project.allowed_to_condition(User.current, :view_news) ], :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") | |
44 end | |
40 end | 45 end |