diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-08-31 14:13:40 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-08-31 14:13:40 +0000 |
commit | 17312e143c7a58c7e4628e613447bf06fc47184d (patch) | |
tree | 8a29c6a488c8931f06c0919b8a4da7a6137bee31 /app/models/custom_value.rb | |
parent | aa05bd7751022e54344eeffa494f02fbc6d2931a (diff) | |
download | redmine-17312e143c7a58c7e4628e613447bf06fc47184d.tar.gz redmine-17312e143c7a58c7e4628e613447bf06fc47184d.zip |
Rails3: replace deprecated 'validate' method at CustomValue model.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6914 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/custom_value.rb')
-rw-r--r-- | app/models/custom_value.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/custom_value.rb b/app/models/custom_value.rb index 6c6848321..6d4af178a 100644 --- a/app/models/custom_value.rb +++ b/app/models/custom_value.rb @@ -19,6 +19,8 @@ class CustomValue < ActiveRecord::Base belongs_to :custom_field belongs_to :customized, :polymorphic => true + validate :validate_custom_value + def after_initialize if new_record? && custom_field && (customized_type.blank? || (customized && customized.new_record?)) self.value ||= custom_field.default_value @@ -47,7 +49,7 @@ class CustomValue < ActiveRecord::Base end protected - def validate + def validate_custom_value if value.blank? errors.add(:value, :blank) if custom_field.is_required? and value.blank? else |