Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed option :validation_context on property declaration to :valida…

…tes => [list of contexts]
  • Loading branch information...
commit 889c53943535ea7a373df90d734c4c40f24335cf 1 parent 9e71e01
Guy van den Berg authored
View
2  dm-validations/lib/dm-validations/auto_validate.rb
@@ -33,7 +33,7 @@ def auto_generate_validations(property)
return unless property.options[:auto_validation]
opts = {}
- opts[:context] = property.options[:validation_context] if property.options.has_key?(:validation_context)
+ opts[:context] = property.options[:validates] if property.options.has_key?(:validates)
# presence
if property.options.has_key?(:nullable) && !property.options[:nullable]
View
10 dm-validations/spec/validation_spec.rb
@@ -260,12 +260,12 @@ class Comment
class SailBoat
include DataMapper::Resource
include DataMapper::Validate
- property :name, String, :nullable => false , :validation_context => :presence_test
- property :description, String, :length => 10, :validation_context => :length_test_1
- property :notes, String, :length => 2..10, :validation_context => :length_test_2
+ property :name, String, :nullable => false , :validates => :presence_test
+ property :description, String, :length => 10, :validates => :length_test_1
+ property :notes, String, :length => 2..10, :validates => :length_test_2
property :no_validation, String, :auto_validation => false
- property :salesman, String, :nullable => false, :validation_context => [:multi_context_1, :multi_context_2]
- property :code, String, :format => Proc.new { |code| code =~ /A\d{4}/}, :validation_context => :format_test
+ property :salesman, String, :nullable => false, :validates => [:multi_context_1, :multi_context_2]
+ property :code, String, :format => Proc.new { |code| code =~ /A\d{4}/}, :validates => :format_test
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.