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
This commit is contained in:
Toshi MARUYAMA 2011-09-21 23:50:52 +00:00
parent 579acce9f6
commit 2d541a7e1b
1 changed files with 2 additions and 1 deletions

View File

@ -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