]> source.dussan.org Git - redmine.git/commitdiff
Rails3: model: replace deprecated 'after_save' method at IssueStatus model
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 21 Sep 2011 23:50:52 +0000 (23:50 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 21 Sep 2011 23:50:52 +0000 (23:50 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7436 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue_status.rb

index 938bdafbba93a4203ddea3c076ae534a817e9b4b..600d0cbf46098cd693214fb3ffaa997dea408355 100644 (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