diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-03-21 19:05:09 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-03-21 19:07:15 +0000 |
commit | d758d996d1b66e2a65640f79f01ce2ac674d7ed5 (patch) | |
tree | 4d6e1ef682c76fd655acbd8a66739cf693777454 /activerecord/lib/active_record | |
parent | 320933205e16164ff55245aef1e95fb06e609d06 (diff) | |
download | rails-d758d996d1b66e2a65640f79f01ce2ac674d7ed5.tar.gz rails-d758d996d1b66e2a65640f79f01ce2ac674d7ed5.tar.bz2 rails-d758d996d1b66e2a65640f79f01ce2ac674d7ed5.zip |
Deprecate Model#validate/validate_on_create/validate_on_update. Use Model.validate :method and likewise
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/validations.rb | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 9a7b2a47bc..744205df1b 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -164,14 +164,25 @@ module ActiveRecord run_callbacks(:validate) - validate if respond_to?(:validate) + if respond_to?(:validate) + ActiveSupport::Deprecation.warn("Base#validate has been deprecated, please use Base.validate :method instead") + validate + end if new_record? run_callbacks(:validate_on_create) - validate_on_create if respond_to?(:validate_on_create) + + if respond_to?(:validate_on_create) + ActiveSupport::Deprecation.warn("Base#validate_on_create has been deprecated, please use Base.validate_on_create :method instead") + validate_on_create + end else run_callbacks(:validate_on_update) - validate_on_update if respond_to?(:validate_on_update) + + if respond_to?(:validate_on_update) + ActiveSupport::Deprecation.warn("Base#validate_on_update has been deprecated, please use Base.validate_on_update :method instead") + validate_on_update + end end errors.empty? @@ -185,16 +196,6 @@ module ActiveRecord def get_attribute_value(attribute) respond_to?(attribute.to_sym) ? send(attribute.to_sym) : self[attribute.to_sym] end - - protected - - # Overwrite this method for validation checks used only on creation. - def validate_on_create - end - - # Overwrite this method for validation checks used only on updates. - def validate_on_update - end end end |