summaryrefslogtreecommitdiffstats
path: root/app/models/issue.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/issue.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/issue.rb')
-rw-r--r--app/models/issue.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index a81dda16f..b8ea90efd 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -60,18 +60,19 @@ class Issue < ActiveRecord::Base
validates_numericality_of :estimated_hours, :allow_nil => true
validate :validate_issue
- named_scope :visible, lambda {|*args| { :include => :project,
- :conditions => Issue.visible_condition(args.shift || User.current, *args) } }
+ scope :visible,
+ lambda {|*args| { :include => :project,
+ :conditions => Issue.visible_condition(args.shift || User.current, *args) } }
- named_scope :open, lambda {|*args|
+ scope :open, lambda {|*args|
is_closed = args.size > 0 ? !args.first : false
{:conditions => ["#{IssueStatus.table_name}.is_closed = ?", is_closed], :include => :status}
}
- named_scope :recently_updated, :order => "#{Issue.table_name}.updated_on DESC"
- named_scope :with_limit, lambda { |limit| { :limit => limit} }
- named_scope :on_active_project, :include => [:status, :project, :tracker],
- :conditions => ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"]
+ scope :recently_updated, :order => "#{Issue.table_name}.updated_on DESC"
+ scope :with_limit, lambda { |limit| { :limit => limit} }
+ scope :on_active_project, :include => [:status, :project, :tracker],
+ :conditions => ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"]
before_create :default_assign
before_save :close_duplicates, :update_done_ratio_from_issue_status