# File lib/dm-validations/auto_validate.rb, line 132 def infer_length_validation_for(property, options) return unless [ DataMapper::Property::String, DataMapper::Property::Text ].include?(property.class) case length = property.options.fetch(:length, DataMapper::Property::String::DEFAULT_LENGTH) when Range then options[:within] = length else options[:maximum] = length end validates_length_of property.name, options_with_message(options, property, :length) end