diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-09-21 04:50:58 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-09-21 04:50:58 +0000 |
commit | 92403eb85506fbd71d62a62dca372b0dfa82d750 (patch) | |
tree | adfe8d01d1e2d3a668b92bb5d36f014e7105d39c /app/models/enumeration.rb | |
parent | 3268a190ae4a99b6a41bdff7334e986eec3635ec (diff) | |
download | redmine-92403eb85506fbd71d62a62dca372b0dfa82d750.tar.gz redmine-92403eb85506fbd71d62a62dca372b0dfa82d750.zip |
Rails3: model: replace deprecated 'before_save' method at Enumeration model
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7427 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/enumeration.rb')
-rw-r--r-- | app/models/enumeration.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/enumeration.rb b/app/models/enumeration.rb index 4965c31c6..b8cbd84f2 100644 --- a/app/models/enumeration.rb +++ b/app/models/enumeration.rb @@ -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 |