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

app/models/enumeration.rb

index 4965c31c6957bf6fbc7e3231878c82627dd40174..b8cbd84f2cae85376de2a08babb2158567d492f8 100644 (file)
@@ -25,6 +25,7 @@ class Enumeration < ActiveRecord::Base
   acts_as_tree :order => 'position ASC'
 
   before_destroy :check_integrity
+  before_save    :check_default
 
   validates_presence_of :name
   validates_uniqueness_of :name, :scope => [:type, :project_id]
@@ -51,7 +52,7 @@ class Enumeration < ActiveRecord::Base
     nil
   end
 
-  def before_save
+  def check_default
     if is_default? && is_default_changed?
       Enumeration.update_all("is_default = #{connection.quoted_false}", {:type => type})
     end