summaryrefslogtreecommitdiffstats
path: root/app/models/principal.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-04-26 23:51:10 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-04-26 23:51:10 +0000
commitd0d01d4e704b0d15dfd3ce2d5213ab8b5a6678fb (patch)
tree31a2f938e01ae8032d0e4c19d979f7df575d332e /app/models/principal.rb
parent71649ba2f137f3a48af031193af2b7f315519299 (diff)
downloadredmine-d0d01d4e704b0d15dfd3ce2d5213ab8b5a6678fb.tar.gz
redmine-d0d01d4e704b0d15dfd3ce2d5213ab8b5a6678fb.zip
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
Diffstat (limited to 'app/models/principal.rb')
-rw-r--r--app/models/principal.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/principal.rb b/app/models/principal.rb
index de6539986..f2bec0e26 100644
--- a/app/models/principal.rb
+++ b/app/models/principal.rb
@@ -24,9 +24,9 @@ class Principal < ActiveRecord::Base
has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify
# Groups and active users
- named_scope :active, :conditions => "#{Principal.table_name}.status = 1"
+ scope :active, :conditions => "#{Principal.table_name}.status = 1"
- named_scope :like, lambda {|q|
+ scope :like, lambda {|q|
if q.blank?
{}
else
@@ -44,7 +44,7 @@ class Principal < ActiveRecord::Base
}
# Principals that are members of a collection of projects
- named_scope :member_of, lambda {|projects|
+ scope :member_of, lambda {|projects|
projects = [projects] unless projects.is_a?(Array)
if projects.empty?
{:conditions => "1=0"}
@@ -54,7 +54,7 @@ class Principal < ActiveRecord::Base
end
}
# Principals that are not members of projects
- named_scope :not_member_of, lambda {|projects|
+ scope :not_member_of, lambda {|projects|
projects = [projects] unless projects.is_a?(Array)
if projects.empty?
{:conditions => "1=0"}