summaryrefslogtreecommitdiffstats
path: root/app/models/issue_status.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-09-21 23:50:52 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-09-21 23:50:52 +0000
commit2d541a7e1b233cb050480e4ac81fc7363157b6c3 (patch)
treec9d8bdc178eb681c4f7c3445905a8f5f471d0b79 /app/models/issue_status.rb
parent579acce9f60e2e33c23d16aceabda3d2f98c9893 (diff)
downloadredmine-2d541a7e1b233cb050480e4ac81fc7363157b6c3.tar.gz
redmine-2d541a7e1b233cb050480e4ac81fc7363157b6c3.zip
Rails3: model: replace deprecated 'after_save' method at IssueStatus model
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7436 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_status.rb')
-rw-r--r--app/models/issue_status.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/issue_status.rb b/app/models/issue_status.rb
index 938bdafbb..600d0cbf4 100644
--- a/app/models/issue_status.rb
+++ b/app/models/issue_status.rb
@@ -21,6 +21,7 @@ class IssueStatus < ActiveRecord::Base
acts_as_list
before_destroy :delete_workflows
+ after_save :update_default
validates_presence_of :name
validates_uniqueness_of :name
@@ -29,7 +30,7 @@ class IssueStatus < ActiveRecord::Base
named_scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}}
- def after_save
+ def update_default
IssueStatus.update_all("is_default=#{connection.quoted_false}", ['id <> ?', id]) if self.is_default?
end