summaryrefslogtreecommitdiffstats
path: root/app/models/news.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-07 17:59:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-07 17:59:20 +0000
commit7222e4012db58c53d364e3b065e70338c094e878 (patch)
tree2d0a723b9d9030591967b9932587fb5987062ce0 /app/models/news.rb
parent4896d5c7e83bb3cc7996c5ab09441c90e7cd9ce1 (diff)
downloadredmine-7222e4012db58c53d364e3b065e70338c094e878.tar.gz
redmine-7222e4012db58c53d364e3b065e70338c094e878.zip
Rewrites named scopes with ARel queries.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10950 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/news.rb')
-rw-r--r--app/models/news.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/models/news.rb b/app/models/news.rb
index 1810baa33..24fc6ec48 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -34,10 +34,9 @@ class News < ActiveRecord::Base
after_create :add_author_as_watcher
- scope :visible, lambda {|*args| {
- :include => :project,
- :conditions => Project.allowed_to_condition(args.shift || User.current, :view_news, *args)
- }}
+ scope :visible, lambda {|*args|
+ includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
+ }
safe_attributes 'title', 'summary', 'description'