diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2012-05-04 23:35:29 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2012-05-04 23:35:29 +0000 |
commit | 569e1b37cc0893cd8b1015a6d12212b205f0fbdf (patch) | |
tree | 96695b9ac44da0b993240bdffe46acd2d25f1e18 /app/models/news.rb | |
parent | bef28f7dabc4edbef6c024af602355bc521b0a7f (diff) | |
download | redmine-569e1b37cc0893cd8b1015a6d12212b205f0fbdf.tar.gz redmine-569e1b37cc0893cd8b1015a6d12212b205f0fbdf.zip |
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
Diffstat (limited to 'app/models/news.rb')
-rw-r--r-- | app/models/news.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/app/models/news.rb b/app/models/news.rb index bf1cc4f80..11be6d130 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -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 |