Browse Source

model: convert news finder to Rails3 syntax

Contributed by Felix Schäfer.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9624 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/2.0.0
Toshi MARUYAMA 12 years ago
parent
commit
569e1b37cc
1 changed files with 3 additions and 4 deletions
  1. 3
    4
      app/models/news.rb

+ 3
- 4
app/models/news.rb View File

@@ -52,10 +52,9 @@ class News < ActiveRecord::Base

# returns latest news for projects visible by user
def self.latest(user = User.current, count = 5)
find(:all, :limit => count,
:conditions => Project.allowed_to_condition(user, :view_news),
:include => [ :author, :project ],
:order => "#{News.table_name}.created_on DESC")
includes([:author, :project]).where(
Project.allowed_to_condition(user, :view_news)
).order("#{News.table_name}.created_on DESC").limit(count).all
end

private

Loading…
Cancel
Save