model: replace Rails2 "named_scope" to Rails3 "scope"

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9537 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2012-04-26 23:51:10 +00:00
parent 71649ba2f1
commit d0d01d4e70
19 changed files with 49 additions and 47 deletions
+3 -3
View File
@@ -26,9 +26,9 @@ class Role < ActiveRecord::Base
['own', :label_issues_visibility_own]
]
named_scope :sorted, {:order => 'builtin, position'}
named_scope :givable, { :conditions => "builtin = 0", :order => 'position' }
named_scope :builtin, lambda { |*args|
scope :sorted, {:order => 'builtin, position'}
scope :givable, { :conditions => "builtin = 0", :order => 'position' }
scope :builtin, lambda { |*args|
compare = 'not' if args.first == true
{ :conditions => "#{compare} builtin = 0" }
}