Changing some validations to be compatible with activemodel.

This commit is contained in:
Tapajós 2009-10-30 16:07:59 -02:00
parent d4010ad76e
commit 58d621d399
11 changed files with 54 additions and 30 deletions

View file

@ -93,16 +93,21 @@ module CouchRest
# property :another_required, String
# property :yet_again, String
#
# validates_present :required_attribute
# validates_present :another_required, :yet_again
# validates_presence_of :required_attribute
# validates_presence_of :another_required, :yet_again
#
# # a call to valid? will return false unless
# # all three attributes are !blank?
# end
def validates_present(*fields)
def validates_presence_of(*fields)
opts = opts_from_validator_args(fields)
add_validator_to_context(opts, fields, CouchRest::Validation::RequiredFieldValidator)
end
def validates_present(*fields)
warn "[DEPRECATION] `validates_present` is deprecated. Please use `validates_presence_of` instead."
validates_presence_of(*fields)
end
end # module ValidatesPresent
end # module Validation